mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
bpo-31095: fix potential crash during GC (GH-2974)
This commit is contained in:
parent
bf9075a0c5
commit
a6296d34a4
14 changed files with 60 additions and 13 deletions
|
@ -113,6 +113,7 @@ partial_new(PyTypeObject *type, PyObject *args, PyObject *kw)
|
|||
static void
|
||||
partial_dealloc(partialobject *pto)
|
||||
{
|
||||
/* bpo-31095: UnTrack is needed before calling any callbacks */
|
||||
PyObject_GC_UnTrack(pto);
|
||||
if (pto->weakreflist != NULL)
|
||||
PyObject_ClearWeakRefs((PyObject *) pto);
|
||||
|
@ -1073,7 +1074,11 @@ lru_cache_clear_list(lru_list_elem *link)
|
|||
static void
|
||||
lru_cache_dealloc(lru_cache_object *obj)
|
||||
{
|
||||
lru_list_elem *list = lru_cache_unlink_list(obj);
|
||||
lru_list_elem *list;
|
||||
/* bpo-31095: UnTrack is needed before calling any callbacks */
|
||||
PyObject_GC_UnTrack(obj);
|
||||
|
||||
list = lru_cache_unlink_list(obj);
|
||||
Py_XDECREF(obj->maxsize_O);
|
||||
Py_XDECREF(obj->func);
|
||||
Py_XDECREF(obj->cache);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue