Skip to content

Commit

Permalink
Revert "pythongh-99741: Clean Up the _xxsubinterpreters Module (pytho…
Browse files Browse the repository at this point in the history
…ngh-99940)"

This reverts commit 0547a98.
  • Loading branch information
ramvikrams authored Dec 5, 2022
1 parent 922a6cf commit 79983f0
Show file tree
Hide file tree
Showing 4 changed files with 310 additions and 652 deletions.
2 changes: 1 addition & 1 deletion Include/cpython/pystate.h
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ struct _xid {

PyAPI_FUNC(int) _PyObject_GetCrossInterpreterData(PyObject *, _PyCrossInterpreterData *);
PyAPI_FUNC(PyObject *) _PyCrossInterpreterData_NewObject(_PyCrossInterpreterData *);
PyAPI_FUNC(int) _PyCrossInterpreterData_Release(_PyCrossInterpreterData *);
PyAPI_FUNC(void) _PyCrossInterpreterData_Release(_PyCrossInterpreterData *);

PyAPI_FUNC(int) _PyObject_CheckCrossInterpreterData(PyObject *);

Expand Down
26 changes: 1 addition & 25 deletions Lib/test/test__xxsubinterpreters.py
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,7 @@ def test_types(self):
self._assert_values([
b'spam',
9999,
self.cid,
])

def test_bytes(self):
Expand Down Expand Up @@ -1212,18 +1213,6 @@ def test_equality(self):
self.assertFalse(cid1 != cid2)
self.assertTrue(cid1 != cid3)

def test_shareable(self):
chan = interpreters.channel_create()

obj = interpreters.channel_create()
interpreters.channel_send(chan, obj)
got = interpreters.channel_recv(chan)

self.assertEqual(got, obj)
self.assertIs(type(got), type(obj))
# XXX Check the following in the channel tests?
#self.assertIsNot(got, obj)


class ChannelTests(TestBase):

Expand Down Expand Up @@ -1556,19 +1545,6 @@ def test_recv_default(self):
self.assertEqual(obj5, b'eggs')
self.assertIs(obj6, default)

def test_recv_sending_interp_destroyed(self):
cid = interpreters.channel_create()
interp = interpreters.create()
interpreters.run_string(interp, dedent(f"""
import _xxsubinterpreters as _interpreters
_interpreters.channel_send({cid}, b'spam')
"""))
interpreters.destroy(interp)

with self.assertRaisesRegex(RuntimeError,
'unrecognized interpreter ID'):
interpreters.channel_recv(cid)

def test_run_string_arg_unresolved(self):
cid = interpreters.channel_create()
interp = interpreters.create()
Expand Down
Loading

0 comments on commit 79983f0

Please sign in to comment.