summaryrefslogtreecommitdiff
path: root/Python
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2008-11-08 19:56:21 +0000
committerBenjamin Peterson <benjamin@python.org>2008-11-08 19:56:21 +0000
commitbde1676b06fe4c18892f5cbe654bdbc8e34cecba (patch)
tree608e763736f02d2ff2c1fe6743ec0a9e88384299 /Python
parent06fd5f8cc854c79b5a4b113d7ef9ab01227d94cf (diff)
downloadcpython-git-bde1676b06fe4c18892f5cbe654bdbc8e34cecba.tar.gz
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 ........
Diffstat (limited to 'Python')
-rw-r--r--Python/ast.c1
-rw-r--r--Python/compile.c6
2 files changed, 1 insertions, 6 deletions
diff --git a/Python/ast.c b/Python/ast.c
index 60906a1f56..1cf100e449 100644
--- a/Python/ast.c
+++ b/Python/ast.c
@@ -354,6 +354,7 @@ static const char* FORBIDDEN[] = {
"None",
"True",
"False",
+ "__debug__",
NULL,
};
diff --git a/Python/compile.c b/Python/compile.c
index 4600589a5e..50eb1693de 100644
--- a/Python/compile.c
+++ b/Python/compile.c
@@ -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;