Commit bde1676b authored by Benjamin Peterson's avatar Benjamin Peterson

Merged revisions 67171 via svnmerge from

svn+ssh://pythondev@svn.python.org/python/trunk

........
  r67171 | benjamin.peterson | 2008-11-08 12:38:54 -0600 (Sat, 08 Nov 2008) | 4 lines

  check for assignment to __debug__ during AST generation

  Also, give assignment to None a better error message
........
parent 06fd5f8c
...@@ -354,6 +354,7 @@ static const char* FORBIDDEN[] = { ...@@ -354,6 +354,7 @@ static const char* FORBIDDEN[] = {
"None", "None",
"True", "True",
"False", "False",
"__debug__",
NULL, NULL,
}; };
......
...@@ -2498,12 +2498,6 @@ compiler_nameop(struct compiler *c, identifier name, expr_context_ty ctx) ...@@ -2498,12 +2498,6 @@ compiler_nameop(struct compiler *c, identifier name, expr_context_ty ctx)
PyObject *mangled; PyObject *mangled;
/* XXX AugStore isn't used anywhere! */ /* XXX AugStore isn't used anywhere! */
/* First check for assignment to __debug__. Param? */
if ((ctx == Store || ctx == AugStore || ctx == Del)
&& !PyUnicode_CompareWithASCIIString(name, "__debug__")) {
return compiler_error(c, "can not assign to __debug__");
}
mangled = _Py_Mangle(c->u->u_private, name); mangled = _Py_Mangle(c->u->u_private, name);
if (!mangled) if (!mangled)
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment