File tree Expand file tree Collapse file tree 2 files changed +1
-51
lines changed
test/test_concurrent_futures Expand file tree Collapse file tree 2 files changed +1
-51
lines changed Original file line number Diff line number Diff line change @@ -5,37 +5,7 @@ class ItemInterpreterDestroyed(Exception):
55 """Raised when trying to get an item whose interpreter was destroyed."""
66
77
8- class UnboundItem :
9- """Represents a cross-interpreter item no longer bound to an interpreter.
10-
11- An item is unbound when the interpreter that added it to the
12- cross-interpreter container is destroyed.
13- """
14-
15- __slots__ = ()
16- _MODULE = __name__
17- _NAME = 'UNBOUND'
18-
19- def __new__ (cls ):
20- raise Exception (f'use { cls ._MODULE } .{ cls ._NAME } ' )
21-
22- def __hash__ (self ):
23- return hash ((self ._NAME , self ._MODULE ))
24-
25- def __reduce__ (self ):
26- return self ._NAME
27-
28- def __eq__ (self , other ):
29- if other is self :
30- return True
31- return repr (other ) == repr (self )
32-
33- def __repr__ (self ):
34- return f'{ self ._MODULE } .{ self ._NAME } '
35- # return f'interpreters._queues.UNBOUND'
36-
37-
38- UNBOUND = UnboundItem ()
8+ UNBOUND = object ()
399UNBOUND_ERROR = object ()
4010UNBOUND_REMOVE = object ()
4111
Original file line number Diff line number Diff line change @@ -516,26 +516,6 @@ def get_thread_name():
516516 self .assertStartsWith (self .executor .submit (get_thread_name ).result (),
517517 "InterpreterPoolExecutor-" [:15 ])
518518
519- def test_cross_interpreter_unbound_identity (self ):
520- # Prepare shared queues.
521- input_q = interpreters .create_queue ()
522- input_q .put (queues .UNBOUND )
523- result_q = interpreters .create_queue ()
524-
525- # Create a sub-interpreter.
526- interp = interpreters .create ()
527- interp .prepare_main ({"input_q" : input_q , "result_q" : result_q })
528-
529- # Run and compare the items in queue.
530- interp .exec ("""
531- from concurrent.interpreters import _queues as queues
532- obj = input_q.get()
533- is_identical = (obj is queues.UNBOUND)
534- result_q.put(is_identical)
535- """ )
536- is_identical = result_q .get ()
537- self .assertTrue (is_identical , "UNBOUND identity mismatch across interpreters" )
538-
539519
540520class AsyncioTest (InterpretersMixin , testasyncio_utils .TestCase ):
541521
You can’t perform that action at this time.
0 commit comments