Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Remove test_cross_interpreter_unbound_identity and picklabe object.
  • Loading branch information
note35 committed Dec 12, 2025
commit f74dcf90b12dfe94da2f5562cd424a0cf8fad161
32 changes: 1 addition & 31 deletions Lib/concurrent/interpreters/_crossinterp.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,37 +5,7 @@ class ItemInterpreterDestroyed(Exception):
"""Raised when trying to get an item whose interpreter was destroyed."""


class UnboundItem:
"""Represents a cross-interpreter item no longer bound to an interpreter.

An item is unbound when the interpreter that added it to the
cross-interpreter container is destroyed.
"""

__slots__ = ()
_MODULE = __name__
_NAME = 'UNBOUND'

def __new__(cls):
raise Exception(f'use {cls._MODULE}.{cls._NAME}')

def __hash__(self):
return hash((self._NAME, self._MODULE))

def __reduce__(self):
return self._NAME

def __eq__(self, other):
if other is self:
return True
return repr(other) == repr(self)

def __repr__(self):
return f'{self._MODULE}.{self._NAME}'
# return f'interpreters._queues.UNBOUND'


UNBOUND = UnboundItem()
UNBOUND = object()
UNBOUND_ERROR = object()
UNBOUND_REMOVE = object()

Expand Down
21 changes: 0 additions & 21 deletions Lib/test/test_concurrent_futures/test_interpreter_pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -516,27 +516,6 @@ def get_thread_name():
self.assertStartsWith(self.executor.submit(get_thread_name).result(),
"InterpreterPoolExecutor-"[:15])

def test_cross_interpreter_unbound_identity(self):
# Prepare shared queues.
input_q = interpreters.create_queue()
input_q.put(queues.UNBOUND)
result_q = interpreters.create_queue()

# Create a sub-interpreter.
interp = interpreters.create()
interp.prepare_main({"input_q": input_q, "result_q": result_q})

# Run and compare the items in queue.
interp.exec("""
from concurrent.interpreters import _queues as queues
obj = input_q.get()
is_identical = (obj is queues.UNBOUND)
result_q.put(is_identical)
""")
is_identical = result_q.get()
self.assertTrue(is_identical, "UNBOUND identity mismatch across interpreters")


class AsyncioTest(InterpretersMixin, testasyncio_utils.TestCase):

@classmethod
Expand Down
Loading