Skip to content

Commit

Permalink
pythongh-100227: Fix Cleanup of the Extensions Cache (pythongh-103150)
Browse files Browse the repository at this point in the history
Decref the key in the right interpreter in _extensions_cache_set().

This is a follow-up to pythongh-103084. I found the bug while working on pythongh-101660.
  • Loading branch information
ericsnowcurrently authored and warsaw committed Apr 11, 2023
1 parent 54698ca commit 7c7f00c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Python/import.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 7c7f00c

Please sign in to comment.