Skip to content

Commit 20d4e20

Browse files
note35encukou
authored andcommitted
Add the repro test into test_queues.py.
1 parent 7aff3fc commit 20d4e20

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
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

0 commit comments

Comments
 (0)