-
-
Notifications
You must be signed in to change notification settings - Fork 33.9k
Closed as not planned
Labels
interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
Bug report
Bug description:
$ echo '"\s"' > test.py
$ python --version
Python 3.13.1
$ python -m test
/tmp/test.py:1: SyntaxWarning: invalid escape sequence '\s'
"\s"
$ python -m test
$ python -m test
$ rm -r __pycache__
$ python -m test
/tmp/test.py:1: SyntaxWarning: invalid escape sequence '\s'
"\s"
$ python -m testI know that’s because byte-code compilation bypasses the parser. However, the resulting behavior makes it difficult to discover SyntaxWarning problems within modules, especially ones in third-party modules for which pip hides the compilation output.
$ pip install glom==22.1.0
Collecting glom==22.1.0
Using cached glom-22.1.0-py2.py3-none-any.whl.metadata (4.9 kB)
Collecting boltons>=19.3.0 (from glom==22.1.0)
Using cached boltons-25.0.0-py3-none-any.whl.metadata (6.5 kB)
Collecting attrs (from glom==22.1.0)
Using cached attrs-25.1.0-py3-none-any.whl.metadata (10 kB)
Collecting face>=20.1.0 (from glom==22.1.0)
Using cached face-24.0.0-py3-none-any.whl.metadata (1.1 kB)
Using cached glom-22.1.0-py2.py3-none-any.whl (100 kB)
Using cached boltons-25.0.0-py3-none-any.whl (194 kB)
Using cached face-24.0.0-py3-none-any.whl (54 kB)
Using cached attrs-25.1.0-py3-none-any.whl (63 kB)
Installing collected packages: boltons, attrs, face, glom
Successfully installed attrs-25.1.0 boltons-25.0.0 face-24.0.0 glom-22.1.0
$ python -m glom
{}
$ rm -r /tmp/v/lib/python3.13/site-packages/glom/__pycache__
$ python -m glom
/tmp/v/lib/python3.13/site-packages/glom/matching.py:764: SyntaxWarning: invalid escape sequence '\ '
"""The :class:`Switch` specifier type routes data processing based on
{}
$ python -m glom
{}It would be better if compilation could record the warning in the .pyc file such that it gets re-emitted on every load, even though the parser was bypassed.
(This was mentioned in #77093 (comment), but it seems nobody took up the suggestion to file this as a separate issue.)
CPython versions tested on:
3.13
Operating systems tested on:
Linux
Metadata
Metadata
Assignees
Labels
interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error