[Python-checkins] cpython (merge 3.5 -> default): Issue #27225: Fixed a reference leak in type_new when setting __new__ fails.
serhiy.storchaka
python-checkins at python.org
Sun Jun 5 04:07:16 EDT 2016
https://hg.python.org/cpython/rev/31ad7885e2e5
changeset: 101753:31ad7885e2e5
parent: 101751:356f411e8c5c
parent: 101752:33b53734805b
user: Serhiy Storchaka <storchaka at gmail.com>
date: Sun Jun 05 10:50:16 2016 +0300
summary:
Issue #27225: Fixed a reference leak in type_new when setting __new__ fails.
Patch by Xiang Zhang.
files:
Objects/typeobject.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/Objects/typeobject.c b/Objects/typeobject.c
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -2580,8 +2580,10 @@
tmp = PyStaticMethod_New(tmp);
if (tmp == NULL)
goto error;
- if (_PyDict_SetItemId(dict, &PyId___new__, tmp) < 0)
+ if (_PyDict_SetItemId(dict, &PyId___new__, tmp) < 0) {
+ Py_DECREF(tmp);
goto error;
+ }
Py_DECREF(tmp);
}
--
Repository URL: https://hg.python.org/cpython
More information about the Python-checkins
mailing list