Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8e8fbea

Browse files
committed
don't leak if the __class__ closure is set
1 parent ae1b94b commit 8e8fbea

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

Python/bltinmodule.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -158,10 +158,8 @@ builtin___build_class__(PyObject *self, PyObject *args, PyObject *kwds)
158158
cls = PyEval_CallObjectWithKeywords(meta, margs, mkw);
159159
Py_DECREF(margs);
160160
}
161-
if (cls != NULL && PyCell_Check(cell)) {
162-
Py_INCREF(cls);
163-
PyCell_SET(cell, cls);
164-
}
161+
if (cls != NULL && PyCell_Check(cell))
162+
PyCell_Set(cell, cls);
165163
Py_DECREF(cell);
166164
}
167165
Py_DECREF(ns);

0 commit comments

Comments
 (0)