mirror of
https://github.com/python/cpython.git
synced 2025-07-19 09:15:34 +00:00
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:
parent
5c6eba3a93
commit
0b43bcf528
7 changed files with 45 additions and 17 deletions
|
@ -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];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue