Skip to content

Commit fcb3385

Browse files
committed
Add the repro test into test_queues.py.
1 parent 5730fd5 commit fcb3385

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

Lib/test/test_interpreters/test_queues.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
# Raise SkipTest if subinterpreters not supported.
99
_queues = import_helper.import_module('_interpqueues')
1010
from concurrent import interpreters
11+
from concurrent.futures import InterpreterPoolExecutor
1112
from concurrent.interpreters import _queues as queues, _crossinterp
1213
from .utils import _run_output, TestBase as _TestBase
1314

@@ -93,6 +94,14 @@ def test_bind_release(self):
9394
with self.assertRaises(queues.QueueError):
9495
_queues.release(qid)
9596

97+
def test_interpreter_pool_executor_after_reload(self):
98+
# Regression test for gh-142414 (KeyError in serialize_unbound).
99+
importlib.reload(queues)
100+
code = "import struct"
101+
with InterpreterPoolExecutor(max_workers=1) as executor:
102+
results = executor.map(exec, [code] * 1)
103+
self.assertEqual(list(results), [None] * 1)
104+
96105

97106
class QueueTests(TestBase):
98107

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Unified the UNBOUND constant in the internal implementation of Lib/concurrent/interpreters.
1+
Fix spurious KeyError when concurrent.interpreters is reloaded after import.

0 commit comments

Comments
 (0)