[Python-checkins] cpython: Issue #24064: Help property() support GC

raymond.hettinger python-checkins at python.org
Wed May 13 20:12:45 CEST 2015


https://hg.python.org/cpython/rev/2ddadd0e736d
changeset:   96029:2ddadd0e736d
user:        Raymond Hettinger <python at rcn.com>
date:        Wed May 13 11:12:33 2015 -0700
summary:
  Issue #24064: Help property() support GC

files:
  Objects/descrobject.c |  10 +++++++++-
  1 files changed, 9 insertions(+), 1 deletions(-)


diff --git a/Objects/descrobject.c b/Objects/descrobject.c
--- a/Objects/descrobject.c
+++ b/Objects/descrobject.c
@@ -1592,6 +1592,14 @@
     return 0;
 }
 
+static int
+property_clear(PyObject *self)
+{
+    propertyobject *pp = (propertyobject *)self;
+    Py_CLEAR(pp->prop_doc);
+    return 0;
+}
+
 PyTypeObject PyProperty_Type = {
     PyVarObject_HEAD_INIT(&PyType_Type, 0)
     "property",                                 /* tp_name */
@@ -1617,7 +1625,7 @@
         Py_TPFLAGS_BASETYPE,                    /* tp_flags */
     property_doc,                               /* tp_doc */
     property_traverse,                          /* tp_traverse */
-    0,                                          /* tp_clear */
+    (inquiry)property_clear,                    /* tp_clear */
     0,                                          /* tp_richcompare */
     0,                                          /* tp_weaklistoffset */
     0,                                          /* tp_iter */

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list