summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2019-11-22 09:58:00 (GMT)
committerGitHub <noreply@github.com>2019-11-22 09:58:00 (GMT)
commit310e2d25170a88ef03f6fd31efcc899fe062da2c (patch)
tree183e69c59f1997d35021f3e708c4056bb8303a05 /Modules
parent91daa9d7224626dad4bb820924c01b3438ca6e3f (diff)
downloadcpython-310e2d25170a88ef03f6fd31efcc899fe062da2c.zip
cpython-310e2d25170a88ef03f6fd31efcc899fe062da2c.tar.gz
cpython-310e2d25170a88ef03f6fd31efcc899fe062da2c.tar.bz2
bpo-36854: Fix refleak in subinterpreter (GH-17331)
finalize_interp_clear() now explicitly clears the codec registry and then trigger a GC collection to clear all references.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_testcapimodule.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/Modules/_testcapimodule.c b/Modules/_testcapimodule.c
index baa6907..0908f34 100644
--- a/Modules/_testcapimodule.c
+++ b/Modules/_testcapimodule.c
@@ -6721,11 +6721,14 @@ PyInit__testcapi(void)
PyModule_AddObject(m, "instancemethod", (PyObject *)&PyInstanceMethod_Type);
PyModule_AddIntConstant(m, "the_number_three", 3);
+ PyObject *v;
#ifdef WITH_PYMALLOC
- PyModule_AddObject(m, "WITH_PYMALLOC", Py_True);
+ v = Py_True;
#else
- PyModule_AddObject(m, "WITH_PYMALLOC", Py_False);
+ v = Py_False;
#endif
+ Py_INCREF(v);
+ PyModule_AddObject(m, "WITH_PYMALLOC", v);
TestError = PyErr_NewException("_testcapi.error", NULL, NULL);
Py_INCREF(TestError);