mirror of
https://github.com/python/cpython.git
synced 2025-10-28 17:13:08 +00:00
use a invalid name for the __class__ closure for super() (closes #12370)
This prevents the assignment of __class__ in the class body from breaking super. (Although a determined person could do locals()["@__class__"] = 4)
This commit is contained in:
parent
019d0f27a3
commit
f5ff22329b
5 changed files with 26 additions and 10 deletions
|
|
@ -1566,7 +1566,7 @@ compiler_class(struct compiler *c, stmt_ty s)
|
|||
return 0;
|
||||
}
|
||||
/* return the (empty) __class__ cell */
|
||||
str = PyUnicode_InternFromString("__class__");
|
||||
str = PyUnicode_InternFromString("@__class__");
|
||||
if (str == NULL) {
|
||||
compiler_exit_scope(c);
|
||||
return 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue