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 iritkatriel
Recipients Naftali.Harris, benjamin.peterson, georg.brandl, iritkatriel, kbk, ncoghlan
Date 2020-09-18.18:34:02
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1600454042.57.0.0190103423686.issue29107@roundup.psfhosted.org>
In-reply-to
Content
As stated above, this has been fixed in python 3:

**********************************************************
C:\Users\User\src\cpython>type x.py
def f(x):
    global x

C:\Users\User\src\cpython>python.bat
Running Release|Win32 interpreter...
Python 3.10.0a0 (heads/bpo11414-dirty:6595cb0af4, Sep 18 2020, 19:01:13) [MSC v.1916 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import traceback
>>> import x
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\User\src\cpython\x.py", line 2
    global x
    ^
SyntaxError: name 'x' is parameter and global
>>> try:
...     import x
... except:
...     traceback.print_exc()
...
Traceback (most recent call last):
  File "<stdin>", line 2, in <module>
  File "C:\Users\User\src\cpython\x.py", line 2
    global x
    ^
SyntaxError: name 'x' is parameter and global
>>>


**********************************************************
>>> e = SyntaxError("some message", ("myfile.py", None, None, None))
>>> raise e
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
SyntaxError: some message (myfile.py)
>>> try:
...     raise e
... except:
...     traceback.print_exc()
...
Traceback (most recent call last):
  File "<stdin>", line 2, in <module>
  File "<stdin>", line 2, in <module>
  File "<stdin>", line 1, in <module>
  File "myfile.py", line None
SyntaxError: some message
**********************************************************

>>> e = SyntaxError("some message", ("myfile.py", 3, 10, "hello"))
>>> raise r
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'r' is not defined
>>> raise e
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "myfile.py", line 3
    hello
         ^
SyntaxError: some message
>>> try:
...     raise e
... except:
...     traceback.print_exc()
...
Traceback (most recent call last):
  File "<stdin>", line 2, in <module>
  File "<stdin>", line 1, in <module>
  File "myfile.py", line 3
    hello
         ^
SyntaxError: some message
History
Date User Action Args
2020-09-18 18:34:02iritkatrielsetrecipients: + iritkatriel, georg.brandl, kbk, ncoghlan, benjamin.peterson, Naftali.Harris
2020-09-18 18:34:02iritkatrielsetmessageid: <1600454042.57.0.0190103423686.issue29107@roundup.psfhosted.org>
2020-09-18 18:34:02iritkatriellinkissue29107 messages
2020-09-18 18:34:02iritkatrielcreate