File tree Expand file tree Collapse file tree 2 files changed +13
-2
lines changed
Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -6721,11 +6721,14 @@ PyInit__testcapi(void)
67216721 PyModule_AddObject (m , "instancemethod" , (PyObject * )& PyInstanceMethod_Type );
67226722
67236723 PyModule_AddIntConstant (m , "the_number_three" , 3 );
6724+ PyObject * v ;
67246725#ifdef WITH_PYMALLOC
6725- PyModule_AddObject ( m , "WITH_PYMALLOC" , Py_True ) ;
6726+ v = Py_True ;
67266727#else
6727- PyModule_AddObject ( m , "WITH_PYMALLOC" , Py_False ) ;
6728+ v = Py_False ;
67286729#endif
6730+ Py_INCREF (v );
6731+ PyModule_AddObject (m , "WITH_PYMALLOC" , v );
67296732
67306733 TestError = PyErr_NewException ("_testcapi.error" , NULL , NULL );
67316734 Py_INCREF (TestError );
Original file line number Diff line number Diff line change @@ -1210,6 +1210,14 @@ finalize_interp_clear(PyThreadState *tstate)
12101210{
12111211 int is_main_interp = _Py_IsMainInterpreter (tstate );
12121212
1213+ /* bpo-36854: Explicitly clear the codec registry
1214+ and trigger a GC collection */
1215+ PyInterpreterState * interp = tstate -> interp ;
1216+ Py_CLEAR (interp -> codec_search_path );
1217+ Py_CLEAR (interp -> codec_search_cache );
1218+ Py_CLEAR (interp -> codec_error_registry );
1219+ _PyGC_CollectNoFail ();
1220+
12131221 /* Clear interpreter state and all thread states */
12141222 PyInterpreterState_Clear (tstate -> interp );
12151223
You can’t perform that action at this time.
0 commit comments