From dde028480e57bffa83fb084b15ec22490c42ef93 Mon Sep 17 00:00:00 2001 From: Eric Snow Date: Fri, 31 Mar 2023 12:09:10 -0600 Subject: gh-100227: Fix Cleanup of the Extensions Cache (gh-103150) Decref the key in the right interpreter in _extensions_cache_set(). This is a follow-up to gh-103084. I found the bug while working on gh-101660. --- Python/import.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Python/import.c b/Python/import.c index a45b3bfa..24249ae 100644 --- a/Python/import.c +++ b/Python/import.c @@ -983,13 +983,13 @@ _extensions_cache_set(PyObject *filename, PyObject *name, PyModuleDef *def) res = 0; finally: + Py_XDECREF(key); if (oldts != NULL) { _PyThreadState_Swap(interp->runtime, oldts); _PyThreadState_UnbindDetached(main_tstate); Py_DECREF(name); Py_DECREF(filename); } - Py_XDECREF(key); extensions_lock_release(); return res; } -- cgit v0.12