[Python-checkins] python/dist/src/Python newcompile.c, 1.1.2.94,
1.1.2.95
jhylton at users.sourceforge.net
jhylton at users.sourceforge.net
Fri Apr 23 00:12:31 EDT 2004
Update of /cvsroot/python/python/dist/src/Python
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11235
Modified Files:
Tag: ast-branch
newcompile.c
Log Message:
Disallow assignment to __debug__.
This version happens to catch more cases than standard Python.
Index: newcompile.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/Attic/newcompile.c,v
retrieving revision 1.1.2.94
retrieving revision 1.1.2.95
diff -C2 -d -r1.1.2.94 -r1.1.2.95
*** newcompile.c 22 Apr 2004 16:11:15 -0000 1.1.2.94
--- newcompile.c 23 Apr 2004 04:12:28 -0000 1.1.2.95
***************
*** 2037,2040 ****
--- 2037,2047 ----
PyObject *dict = c->u->u_names;
/* XXX AugStore isn't used anywhere! */
+
+ /* First check for assignment to __debug__. Param? */
+ if ((ctx == Store || ctx == AugStore || ctx == Del)
+ && !strcmp(PyString_AS_STRING(name), "__debug__")) {
+ return compiler_error(c, "can not assign to __debug__");
+ }
+
op = 0;
optype = OP_NAME;
More information about the Python-checkins
mailing list