Skip to content

Commit 0f55829

Browse files
committed
Add a test case.
1 parent 172d819 commit 0f55829

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

Lib/test/test_interpreters/test_api.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -419,6 +419,22 @@ def test_pickle(self):
419419
unpickled = pickle.loads(data)
420420
self.assertEqual(unpickled, interp)
421421

422+
@support.requires_subprocess()
423+
@force_not_colorized
424+
def test_cleanup_in_repl(self):
425+
# GH-135729: Using a subinterpreter in the REPL would lead to an unraisable
426+
# exception during finalization
427+
repl = script_helper.spawn_python("-i")
428+
script = b"""if True:
429+
from concurrent import interpreters
430+
interpreters.create()
431+
exit()"""
432+
stdout, stderr = repl.communicate(script)
433+
self.assertIsNone(stderr)
434+
self.assertIn(b"remaining subinterpreters", stdout)
435+
self.assertNotIn(b"Traceback", stdout)
436+
437+
422438

423439
class TestInterpreterIsRunning(TestBase):
424440

0 commit comments

Comments
 (0)