Skip to content

Commit dde0284

Browse files
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.
1 parent 9048d73 commit dde0284

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Python/import.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -983,13 +983,13 @@ _extensions_cache_set(PyObject *filename, PyObject *name, PyModuleDef *def)
983983
res = 0;
984984

985985
finally:
986+
Py_XDECREF(key);
986987
if (oldts != NULL) {
987988
_PyThreadState_Swap(interp->runtime, oldts);
988989
_PyThreadState_UnbindDetached(main_tstate);
989990
Py_DECREF(name);
990991
Py_DECREF(filename);
991992
}
992-
Py_XDECREF(key);
993993
extensions_lock_release();
994994
return res;
995995
}

0 commit comments

Comments
 (0)