]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
don't leak if the __class__ closure is set
authorBenjamin Peterson <benjamin@python.org>
Sat, 2 Jun 2012 06:57:36 +0000 (23:57 -0700)
committerBenjamin Peterson <benjamin@python.org>
Sat, 2 Jun 2012 06:57:36 +0000 (23:57 -0700)
Python/bltinmodule.c

index e2ff0ba1c5304df64c805eb135219b8a3cec1af0..232e3dc497091de093a96ed5b305c15209a2791c 100644 (file)
@@ -158,10 +158,8 @@ builtin___build_class__(PyObject *self, PyObject *args, PyObject *kwds)
             cls = PyEval_CallObjectWithKeywords(meta, margs, mkw);
             Py_DECREF(margs);
         }
-        if (cls != NULL && PyCell_Check(cell)) {
-            Py_INCREF(cls);
-            PyCell_SET(cell, cls);
-        }
+        if (cls != NULL && PyCell_Check(cell))
+            PyCell_Set(cell, cls);
         Py_DECREF(cell);
     }
     Py_DECREF(ns);