Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit bde1676

Browse files
committed
Merged revisions 67171 via svnmerge from
svn+ssh://[email protected]/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 ........
1 parent 06fd5f8 commit bde1676

2 files changed

Lines changed: 1 addition & 6 deletions

File tree

Python/ast.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,7 @@ static const char* FORBIDDEN[] = {
354354
"None",
355355
"True",
356356
"False",
357+
"__debug__",
357358
NULL,
358359
};
359360

Python/compile.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2498,12 +2498,6 @@ compiler_nameop(struct compiler *c, identifier name, expr_context_ty ctx)
24982498
PyObject *mangled;
24992499
/* XXX AugStore isn't used anywhere! */
25002500

2501-
/* First check for assignment to __debug__. Param? */
2502-
if ((ctx == Store || ctx == AugStore || ctx == Del)
2503-
&& !PyUnicode_CompareWithASCIIString(name, "__debug__")) {
2504-
return compiler_error(c, "can not assign to __debug__");
2505-
}
2506-
25072501
mangled = _Py_Mangle(c->u->u_private, name);
25082502
if (!mangled)
25092503
return 0;

0 commit comments

Comments
 (0)