mirror of
https://github.com/python/cpython.git
synced 2025-12-08 06:10:17 +00:00
GH-141509: Fix warning about remaining subinterpreters (GH-141528)
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
This commit is contained in:
parent
10bec7c1eb
commit
fa245df4a0
3 changed files with 5 additions and 2 deletions
|
|
@ -432,7 +432,7 @@ def test_cleanup_in_repl(self):
|
||||||
exit()"""
|
exit()"""
|
||||||
stdout, stderr = repl.communicate(script)
|
stdout, stderr = repl.communicate(script)
|
||||||
self.assertIsNone(stderr)
|
self.assertIsNone(stderr)
|
||||||
self.assertIn(b"remaining subinterpreters", stdout)
|
self.assertIn(b"Interpreter.close()", stdout)
|
||||||
self.assertNotIn(b"Traceback", stdout)
|
self.assertNotIn(b"Traceback", stdout)
|
||||||
|
|
||||||
@support.requires_subprocess()
|
@support.requires_subprocess()
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
Suggest using :meth:`concurrent.interpreters.Interpreter.close` instead of the
|
||||||
|
private ``_interpreters.destroy`` function when warning about remaining subinterpreters.
|
||||||
|
Patch by Sergey Miryanov.
|
||||||
|
|
@ -2643,7 +2643,7 @@ finalize_subinterpreters(void)
|
||||||
(void)PyErr_WarnEx(
|
(void)PyErr_WarnEx(
|
||||||
PyExc_RuntimeWarning,
|
PyExc_RuntimeWarning,
|
||||||
"remaining subinterpreters; "
|
"remaining subinterpreters; "
|
||||||
"destroy them with _interpreters.destroy()",
|
"close them with Interpreter.close()",
|
||||||
0);
|
0);
|
||||||
|
|
||||||
/* Swap out the current tstate, which we know must belong
|
/* Swap out the current tstate, which we know must belong
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue