diff options
author | Georg Brandl <georg@python.org> | 2006-08-04 06:03:53 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2006-08-04 06:03:53 (GMT) |
commit | 45381938e940279df3962f6ebe01efb8375198a3 (patch) | |
tree | 2a623730d6674772eb81aa4185e1be7d321f31db /Objects | |
parent | d856ce0a1f06a9f4e52188ab45358b7a9c6ecb1e (diff) | |
download | cpython-45381938e940279df3962f6ebe01efb8375198a3.zip cpython-45381938e940279df3962f6ebe01efb8375198a3.tar.gz cpython-45381938e940279df3962f6ebe01efb8375198a3.tar.bz2 |
Fix bug caused by first decrefing, then increfing.
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/descrobject.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/Objects/descrobject.c b/Objects/descrobject.c index 51676f6..1fe6281 100644 --- a/Objects/descrobject.c +++ b/Objects/descrobject.c @@ -1176,7 +1176,6 @@ static int property_init(PyObject *self, PyObject *args, PyObject *kwds) { PyObject *get = NULL, *set = NULL, *del = NULL, *doc = NULL; - PyObject *get_doc = NULL; static char *kwlist[] = {"fget", "fset", "fdel", "doc", 0}; propertyobject *gs = (propertyobject *)self; @@ -1194,16 +1193,16 @@ property_init(PyObject *self, PyObject *args, PyObject *kwds) /* if no docstring given and the getter has one, use that one */ if ((doc == NULL || doc == Py_None) && get != NULL && PyObject_HasAttrString(get, "__doc__")) { - if (!(get_doc = PyObject_GetAttrString(get, "__doc__"))) + doc = PyObject_GetAttrString(get, "__doc__"); + if (doc == NULL) return -1; - Py_DECREF(get_doc); /* it is INCREF'd again below */ - doc = get_doc; + } else { + Py_XINCREF(doc); } Py_XINCREF(get); Py_XINCREF(set); Py_XINCREF(del); - Py_XINCREF(doc); gs->prop_get = get; gs->prop_set = set; |