]> granicus.if.org Git - python/commitdiff
Merged revisions 67171 via svnmerge from
authorBenjamin Peterson <benjamin@python.org>
Sat, 8 Nov 2008 19:56:21 +0000 (19:56 +0000)
committerBenjamin Peterson <benjamin@python.org>
Sat, 8 Nov 2008 19:56:21 +0000 (19:56 +0000)
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
........

Python/ast.c
Python/compile.c

index 60906a1f569d310119009d9dd273c12ef2834ed1..1cf100e449204477d4bd983af4d1d7786f94d779 100644 (file)
@@ -354,6 +354,7 @@ static const char* FORBIDDEN[] = {
     "None",
     "True",
     "False",
+    "__debug__",
     NULL,
 };
 
index 4600589a5e34bd94a72284669cd2f32b1c1aea38..50eb1693debfbe04227f58343d2aba81bde50394 100644 (file)
@@ -2498,12 +2498,6 @@ compiler_nameop(struct compiler *c, identifier name, expr_context_ty ctx)
        PyObject *mangled;
        /* 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);
        if (!mangled)
                return 0;