From 517bd0dec879c86f4914f6e5778cc53cae778a60 Mon Sep 17 00:00:00 2001 From: "Gregory P. Smith" Date: Sun, 4 Jun 2023 14:17:13 -0700 Subject: [PATCH] restore the singular decref. (correctness) --- Objects/descrobject.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Objects/descrobject.c b/Objects/descrobject.c index f3db1c9df9cce6..e26f90224f68b7 100644 --- a/Objects/descrobject.c +++ b/Objects/descrobject.c @@ -1831,6 +1831,7 @@ property_init_impl(propertyobject *self, PyObject *fget, PyObject *fset, } int err = PyObject_SetAttr( (PyObject *)self, &_Py_ID(__doc__), prop_doc); + Py_DECREF(prop_doc); if (err < 0) { assert(PyErr_Occurred()); if (PyErr_ExceptionMatches(PyExc_AttributeError)) { @@ -1842,10 +1843,8 @@ property_init_impl(propertyobject *self, PyObject *fget, PyObject *fset, // If we ever want to deprecate this behavior, only raise a // warning or error when proc_doc is not None so that // property without a specific doc= still works. - Py_DECREF(prop_doc); return 0; } else { - Py_DECREF(prop_doc); return -1; } }