https://github.com/python/cpython/commit/4101d59902bed8278fb50d6ac50e7227e3fe12ab
commit: 4101d59902bed8278fb50d6ac50e7227e3fe12ab
branch: main
author: Jelle Zijlstra <[email protected]>
committer: JelleZijlstra <[email protected]>
date: 2026-10-20T21:31:59-07:00
summary:
gh-159739: Break reference cycles involving property objects (#159978)
files:
A
Misc/NEWS.d/next/Core_and_Builtins/2026-10-20-00-00-00.gh-issue-159739.848b18.rst
M Objects/descrobject.c
diff --git
a/Misc/NEWS.d/next/Core_and_Builtins/2026-10-20-00-00-00.gh-issue-159739.848b18.rst
b/Misc/NEWS.d/next/Core_and_Builtins/2026-10-20-00-00-00.gh-issue-159739.848b18.rst
new file mode 100644
index 00000000000000..07f842471b4d0f
--- /dev/null
+++
b/Misc/NEWS.d/next/Core_and_Builtins/2026-10-20-00-00-00.gh-issue-159739.848b18.rst
@@ -0,0 +1,2 @@
+Allow the garbage collector to break reference cycles involving property
+accessors or names.
diff --git a/Objects/descrobject.c b/Objects/descrobject.c
index c0af1ed8cad830..c4e525797d19ae 100644
--- a/Objects/descrobject.c
+++ b/Objects/descrobject.c
@@ -2007,7 +2007,11 @@ static int
property_clear(PyObject *self)
{
propertyobject *pp = (propertyobject *)self;
+ Py_CLEAR(pp->prop_get);
+ Py_CLEAR(pp->prop_set);
+ Py_CLEAR(pp->prop_del);
Py_CLEAR(pp->prop_doc);
+ Py_CLEAR(pp->prop_name);
return 0;
}
_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]