Skip to content

Commit 10bb521

Browse files
committed
gh-159739: Break reference cycles involving property objects
Backport to 3.15 and 3.14.
1 parent 80040b6 commit 10bb521

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Allow the garbage collector to break reference cycles involving property
2+
accessors or names.

‎Objects/descrobject.c‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2007,7 +2007,11 @@ static int
20072007
property_clear(PyObject *self)
20082008
{
20092009
propertyobject *pp = (propertyobject *)self;
2010+
Py_CLEAR(pp->prop_get);
2011+
Py_CLEAR(pp->prop_set);
2012+
Py_CLEAR(pp->prop_del);
20102013
Py_CLEAR(pp->prop_doc);
2014+
Py_CLEAR(pp->prop_name);
20112015
return 0;
20122016
}
20132017

0 commit comments

Comments
 (0)