mirror of
https://github.com/python/cpython.git
synced 2025-07-31 07:04:42 +00:00
check for assignment to __debug__ during AST generation
Also, give assignment to None a better error message
This commit is contained in:
parent
942e4779b0
commit
2c98faada6
3 changed files with 11 additions and 17 deletions
|
@ -2344,12 +2344,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)
|
||||
&& !strcmp(PyString_AS_STRING(name), "__debug__")) {
|
||||
return compiler_error(c, "can not assign to __debug__");
|
||||
}
|
||||
|
||||
mangled = _Py_Mangle(c->u->u_private, name);
|
||||
if (!mangled)
|
||||
return 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue