Skip to content

Commit c7cf990

Browse files
committed
Remove test_cross_interpreter_unbound_identity and picklabe object.
1 parent b128769 commit c7cf990

File tree

2 files changed

+1
-51
lines changed

2 files changed

+1
-51
lines changed

Lib/concurrent/interpreters/_crossinterp.py

Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff 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()
399
UNBOUND_ERROR = object()
4010
UNBOUND_REMOVE = object()
4111

Lib/test/test_concurrent_futures/test_interpreter_pool.py

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff 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

540520
class AsyncioTest(InterpretersMixin, testasyncio_utils.TestCase):
541521

0 commit comments

Comments
 (0)