[issue45781] Deleting __debug__ should be an SyntaxError

2021-11-13 Thread Carl Friedrich Bolz-Tereick


Carl Friedrich Bolz-Tereick  added the comment:

ouch, apologies for not checking that!

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45781] Deleting __debug__ should be an SyntaxError

2021-11-12 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Verified in IDLE also.  Thanks for doing the test I should have done.

--
resolution:  -> out of date
stage: test needed -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45781] Deleting __debug__ should be an SyntaxError

2021-11-12 Thread Andre Roberge


Andre Roberge  added the comment:

What version are you using?  As far as I can test, it has become a syntax error 
since 3.10. Here is the result with the latest 3.11 alpha

> python
Python 3.11.0a2 (tags/v3.11.0a2:e2b4e4b, Nov  5 2021, 20:00:05) [MSC v.1929 64 
bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> del __debug__
  File "", line 1
SyntaxError: cannot delete __debug__
>>> exit()

> python
Python 3.11.0a2 (tags/v3.11.0a2:e2b4e4b, Nov  5 2021, 20:00:05) [MSC v.1929 64 
bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> def f():
...del __debug__
...
  File "", line 2
SyntaxError: cannot delete __debug__

--
nosy: +aroberge

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45781] Deleting __debug__ should be an SyntaxError

2021-11-12 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

For comparison:

True = 0
SyntaxError: cannot assign to True
del True
SyntaxError: cannot delete True

It almost seems like __debug__ is a hidden keyword value, but with a 
startup-dependent value

--
components: +Interpreter Core
nosy: +pablogsal, terry.reedy
stage:  -> test needed
type:  -> enhancement
versions: +Python 3.11

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45781] Deleting __debug__ should be an SyntaxError

2021-11-11 Thread Carl Friedrich Bolz-Tereick


New submission from Carl Friedrich Bolz-Tereick :

Right now, deleting __debug__ is not prevented:

>>> def f():
... del __debug__
... 

Of course actually executing it doesn't work:

>>> del __debug__
Traceback (most recent call last):
  File "", line 1, in 
NameError: name '__debug__' is not defined


Compare with assigning to __debug__:

>>> def f():
... __debug__ = 1
... 
  File "", line 2
SyntaxError: cannot assign to __debug__

--
messages: 406149
nosy: Carl.Friedrich.Bolz
priority: normal
severity: normal
status: open
title: Deleting __debug__ should be an SyntaxError

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com