Close #14857: fix regression in references to PEP 3135 implicit __class__ closure variable. Reopens issue #12370, but also updates unittest.mock to workaround that issue

This commit is contained in:
Nick Coghlan 2012-05-27 18:17:07 +10:00
parent 5c6eba3a93
commit 0b43bcf528
7 changed files with 45 additions and 17 deletions

View file

@ -6436,7 +6436,7 @@ super_init(PyObject *self, PyObject *args, PyObject *kwds)
PyObject *name = PyTuple_GET_ITEM(co->co_freevars, i);
assert(PyUnicode_Check(name));
if (!PyUnicode_CompareWithASCIIString(name,
"@__class__")) {
"__class__")) {
Py_ssize_t index = co->co_nlocals +
PyTuple_GET_SIZE(co->co_cellvars) + i;
PyObject *cell = f->f_localsplus[index];