Skip to content

Commit 21e43d5

Browse files
[3.14] GH-141509: Fix warning about remaining subinterpreters (GH-141528) (GH-141566)
(cherry picked from commit fa245df) Co-authored-by: Peter Bierma <[email protected]>
1 parent 8a67e3c commit 21e43d5

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed

Lib/test/test_interpreters/test_api.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -431,6 +431,7 @@ def test_cleanup_in_repl(self):
431431
exit()"""
432432
stdout, stderr = repl.communicate(script)
433433
self.assertIsNone(stderr)
434+
self.assertIn(b"Interpreter.close()", stdout)
434435
self.assertNotIn(b"Traceback", stdout)
435436

436437

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
@@ -2517,7 +2517,7 @@ finalize_subinterpreters(void)
25172517
(void)PyErr_WarnEx(
25182518
PyExc_RuntimeWarning,
25192519
"remaining subinterpreters; "
2520-
"destroy them with _interpreters.destroy()",
2520+
"close them with Interpreter.close()",
25212521
0);
25222522

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

0 commit comments

Comments
 (0)