@@ -386,7 +386,6 @@ def test_types(self):
386386 self ._assert_values ([
387387 b'spam' ,
388388 9999 ,
389- self .cid ,
390389 ])
391390
392391 def test_bytes (self ):
@@ -1213,6 +1212,18 @@ def test_equality(self):
12131212 self .assertFalse (cid1 != cid2 )
12141213 self .assertTrue (cid1 != cid3 )
12151214
1215+ def test_shareable (self ):
1216+ chan = interpreters .channel_create ()
1217+
1218+ obj = interpreters .channel_create ()
1219+ interpreters .channel_send (chan , obj )
1220+ got = interpreters .channel_recv (chan )
1221+
1222+ self .assertEqual (got , obj )
1223+ self .assertIs (type (got ), type (obj ))
1224+ # XXX Check the following in the channel tests?
1225+ #self.assertIsNot(got, obj)
1226+
12161227
12171228class ChannelTests (TestBase ):
12181229
@@ -1545,6 +1556,19 @@ def test_recv_default(self):
15451556 self .assertEqual (obj5 , b'eggs' )
15461557 self .assertIs (obj6 , default )
15471558
1559+ def test_recv_sending_interp_destroyed (self ):
1560+ cid = interpreters .channel_create ()
1561+ interp = interpreters .create ()
1562+ interpreters .run_string (interp , dedent (f"""
1563+ import _xxsubinterpreters as _interpreters
1564+ _interpreters.channel_send({ cid } , b'spam')
1565+ """ ))
1566+ interpreters .destroy (interp )
1567+
1568+ with self .assertRaisesRegex (RuntimeError ,
1569+ 'unrecognized interpreter ID' ):
1570+ interpreters .channel_recv (cid )
1571+
15481572 def test_run_string_arg_unresolved (self ):
15491573 cid = interpreters .channel_create ()
15501574 interp = interpreters .create ()
0 commit comments