Skip to content

Commit fa245df

Browse files
pythonGH-141509: Fix warning about remaining subinterpreters (pythonGH-141528)
Co-authored-by: Peter Bierma <[email protected]>
1 parent 10bec7c commit fa245df

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

Lib/test/test_interpreters/test_api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ def test_cleanup_in_repl(self):
432432
exit()"""
433433
stdout, stderr = repl.communicate(script)
434434
self.assertIsNone(stderr)
435-
self.assertIn(b"remaining subinterpreters", stdout)
435+
self.assertIn(b"Interpreter.close()", stdout)
436436
self.assertNotIn(b"Traceback", stdout)
437437

438438
@support.requires_subprocess()
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Suggest using :meth:`concurrent.interpreters.Interpreter.close` instead of the
2+
private ``_interpreters.destroy`` function when warning about remaining subinterpreters.
3+
Patch by Sergey Miryanov.

Python/pylifecycle.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2643,7 +2643,7 @@ finalize_subinterpreters(void)
26432643
(void)PyErr_WarnEx(
26442644
PyExc_RuntimeWarning,
26452645
"remaining subinterpreters; "
2646-
"destroy them with _interpreters.destroy()",
2646+
"close them with Interpreter.close()",
26472647
0);
26482648

26492649
/* Swap out the current tstate, which we know must belong

0 commit comments

Comments
 (0)