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.
This commit is contained in:
Eric Snow 2023-03-31 12:09:10 -06:00 committed by GitHub
parent 9048d73f7a
commit dde028480e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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;
}