Closed as not planned
Closed as not planned
Description
Bug report
Summary:
With stdlib re
included in Tools/scripts/freeze_modules.py as in the following snippet
('stdlib - startup, with site', [
'_collections_abc',
'_sitebuiltins',
'genericpath',
'ntpath',
'posixpath',
# We must explicitly mark os.path as a frozen module
# even though it will never be imported.
f'{OS_PATH} : os.path',
'os',
'site',
'stat',
'<re.*>',
]),
the following build error occurs
./python.exe -E -S -m sysconfig --generate-posix-vars ;\
if test $? -ne 0 ; then \
echo "generate-posix-vars failed" ; \
rm -f ./pybuilddir.txt ; \
exit 1 ; \
fi
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "/Users/dhk/Desktop/cpython/Lib/sysconfig.py", line 851, in <module>
_main()
File "/Users/dhk/Desktop/cpython/Lib/sysconfig.py", line 839, in _main
_generate_posix_vars()
File "/Users/dhk/Desktop/cpython/Lib/sysconfig.py", line 466, in _generate_posix_vars
import pprint
File "/Users/dhk/Desktop/cpython/Lib/pprint.py", line 38, in <module>
import dataclasses as _dataclasses
File "/Users/dhk/Desktop/cpython/Lib/dataclasses.py", line 5, in <module>
import inspect
File "/Users/dhk/Desktop/cpython/Lib/inspect.py", line 143, in <module>
import linecache
File "/Users/dhk/Desktop/cpython/Lib/linecache.py", line 11, in <module>
import tokenize
File "/Users/dhk/Desktop/cpython/Lib/tokenize.py", line 39, in <module>
blank_re = re.compile(br'^[ \t\f]*(?:[#\r\n]|$)', re.ASCII)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<frozen re>", line 227, in compile
File "<frozen re>", line 294, in _compile
File "<frozen re._compiler>", line 743, in compile
File "<frozen re._parser>", line 980, in parse
File "<frozen re._parser>", line 455, in _parse_sub
File "<frozen re._parser>", line 863, in _parse
File "<frozen re._parser>", line 455, in _parse_sub
File "<frozen re._parser>", line 568, in _parse
File "<frozen re._parser>", line 361, in _class_escape
re.error: bad escape \n at position 16
generate-posix-vars failed
make: *** [pybuilddir.txt] Error 1
Python.exe
manages to build even with the error and I was able to reproduce the re.error
multiple times when trying to run the following snippet:
blank_re = re.compile(br'^[ \t\f]*(?:[#\r\n]|$)', re.ASCII)
This error only occurs when the re
module is frozen and does not occur when re
is imported normally from Lib PATH.
Your environment
- CPython versions tested on: 3.11.1
- Operating system and architecture: Apple M1 MBP, macOS 13.0 (22A380)