diff Objects/typeobject.c @ 70889:2d62ee4e7d98

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)
author Benjamin Peterson <benjamin@python.org>
date Sun, 19 Jun 2011 19:42:22 -0500
parents 6f078d80898f
children 5992cbbedf59
line wrap: on
line diff
--- a/Objects/typeobject.c	Sun Jun 19 17:49:22 2011 -0500
+++ b/Objects/typeobject.c	Sun Jun 19 19:42:22 2011 -0500
@@ -6399,7 +6399,7 @@
             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];