Closed
Labels
type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
Bug report
In the example below, the normal interpreter only emits a SyntaxWarning which, upon execution, gives rise to a TypeError, whereas code.interact() gives a SyntaxError right away.
Python 3.11.0rc2 (main, Sep 11 2022, 20:22:52) [MSC v.1933 64 bit (AMD64)] on win32
>>> def test():
... [1, 2, 3]()
...
<stdin>:2: SyntaxWarning: 'list' object is not callable; perhaps you missed a comma?
>>> test()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<stdin>", line 2, in test
TypeError: 'list' object is not callable
>>>
>>> import code
>>> code.interact()
(InteractiveConsole)
>>> def test():
... [1, 2, 3]()
File "<console>", line 2
SyntaxError: 'list' object is not callable; perhaps you missed a comma?
In addition to the above, I have been able to reproduce this with Python 3.9 and 3.10, but not with earlier Python versions.
Metadata
Metadata
Assignees
Labels
type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Activity
vstinner commentedon Sep 26, 2022
cc @serhiy-storchaka
serhiy-storchaka commentedon Sep 26, 2022
Seems it was fixed in #96052.
aroberge commentedon Oct 24, 2022
This was not fixed.
serhiy-storchaka commentedon Oct 25, 2022
I only get a warning.
aroberge commentedon Oct 25, 2022
I got a warning with 3.12.0a1, but not with 3.11.0. I assume it will be fixed in 3.11.1 and this can remained closed.
vstinner commentedon Nov 3, 2022
I confirm that the fix is not in Python 3.11.0 final: you will have to wait for Python 3.11.1 bugfix release.
Python 3.11.0 has the bug (raise SyntaxError):
The 3.11 development branch has the fix (display a warning):