File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed
Lib/test/test_interpreters Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change 88# Raise SkipTest if subinterpreters not supported.
99_queues = import_helper .import_module ('_interpqueues' )
1010from concurrent import interpreters
11+ from concurrent .futures import InterpreterPoolExecutor
1112from concurrent .interpreters import _queues as queues , _crossinterp
1213from .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
97106class QueueTests (TestBase ):
98107
Original file line number Diff line number Diff line change 1- Unified the UNBOUND constant in the internal implementation of Lib/concurrent/interpreters .
1+ Fix spurious KeyError when concurrent.interpreters is reloaded after import .
You can’t perform that action at this time.
0 commit comments