This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author serhiy.storchaka
Recipients docs@python, jfine2358, matrixise, r.david.murray, serhiy.storchaka
Date 2019-02-20.15:18:58
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1550675938.99.0.0120479234941.issue34464@roundup.psfhosted.org>
In-reply-to
Content
__debug__ is not a keyword. And the error message has been changed in 3.8.

But it is a special enough. You can not use this name in any assignment context:

>>> __debug__ = 1
  File "<stdin>", line 1
SyntaxError: cannot assign to __debug__
>>> for __debug__ in []: pass
... 
  File "<stdin>", line 1
SyntaxError: cannot assign to __debug__
>>> with cm() as __debug__: pass
... 
  File "<stdin>", line 1
SyntaxError: cannot assign to __debug__
>>> class __debug__: pass
... 
  File "<stdin>", line 1
SyntaxError: cannot assign to __debug__
>>> def __debug__(): pass
... 
  File "<stdin>", line 1
SyntaxError: cannot assign to __debug__
>>> def foo(__debug__): pass
... 
  File "<stdin>", line 1
SyntaxError: cannot assign to __debug__
>>> import __debug__
  File "<stdin>", line 1
SyntaxError: cannot assign to __debug__

You can not even assign to an attribute named __debug__!

>>> x.__debug__ = 1
  File "<stdin>", line 1
SyntaxError: cannot assign to __debug__

The assignment operator is the only exception here, and this looks like a bug.
History
Date User Action Args
2019-02-20 15:18:59serhiy.storchakasetrecipients: + serhiy.storchaka, r.david.murray, docs@python, matrixise, jfine2358
2019-02-20 15:18:58serhiy.storchakasetmessageid: <1550675938.99.0.0120479234941.issue34464@roundup.psfhosted.org>
2019-02-20 15:18:58serhiy.storchakalinkissue34464 messages
2019-02-20 15:18:58serhiy.storchakacreate