[Python-checkins] cpython (2.7): 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/db24d51c69d3
changeset: 101754:db24d51c69d3
branch: 2.7
parent: 101750:41fa38ea46ba
user: Serhiy Storchaka <storchaka at gmail.com>
date: Sun Jun 05 11:06:42 2016 +0300
summary:
 Issue #27225: Fixed a reference leak in type_new when setting __new__ fails.
Original patch by Xiang Zhang.
files:
 Objects/typeobject.c | 6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/Objects/typeobject.c b/Objects/typeobject.c
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -2430,7 +2430,11 @@
 Py_DECREF(type);
 return NULL;
 }
- PyDict_SetItemString(dict, "__new__", tmp);
+ if (PyDict_SetItemString(dict, "__new__", tmp) < 0) {
+ Py_DECREF(tmp);
+ Py_DECREF(type);
+ return NULL;
+ }
 Py_DECREF(tmp);
 }
 
-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /