From 8e8fbeae27e3fbfa80ad59fd2aeb563116e6a4c4 Mon Sep 17 00:00:00 2001 From: Benjamin Peterson Date: Fri, 1 Jun 2012 23:57:36 -0700 Subject: [PATCH] don't leak if the __class__ closure is set --- Python/bltinmodule.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c index e2ff0ba1c53..232e3dc4970 100644 --- a/Python/bltinmodule.c +++ b/Python/bltinmodule.c @@ -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);