You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
support named Unicode escapes (\N{name}) in re #74873
The re module specially handles Unicode escapes (\uXXXX and \UXXXXXXXX) so that even raw strings (r'...') have symbolic Unicode characters. But it has not supported named Unicode escapes such as r'\N{EM DASH}', making the escapes for string literals and the escapes for regular expressions asymmetric
This leads to build failures due to circular dependency
At generate-posix-vars stage, unicodedata is imported (due to import pprint)but it has not been built due to it being a C module. However, building C modules happen after generate-posix-vars.
See full message below.
./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 "/Users/fangyi/cpython/Lib/runpy.py", line 193, in _run_module_as_main"__main__", mod_spec)
File "/Users/fangyi/cpython/Lib/runpy.py", line 85, in _run_codeexec(code, run_globals)
File "/Users/fangyi/cpython/Lib/sysconfig.py", line 700, in <module>
_main()
File "/Users/fangyi/cpython/Lib/sysconfig.py", line 688, in _main
_generate_posix_vars()
File "/Users/fangyi/cpython/Lib/sysconfig.py", line 350, in _generate_posix_varsimport pprint
File "/Users/fangyi/cpython/Lib/pprint.py", line 38, in <module>import re
File "/Users/fangyi/cpython/Lib/re.py", line 123, in <module>import sre_compile
File "/Users/fangyi/cpython/Lib/sre_compile.py", line 14, in <module>import sre_parse
File "/Users/fangyi/cpython/Lib/sre_parse.py", line 16, in <module>import unicodedata
ModuleNotFoundError: No module named 'unicodedata'
generate-posix-vars failed
Activity
jonathaneunice commentedon Jun 17, 2017
The re module specially handles Unicode escapes (\uXXXX and \UXXXXXXXX) so that even raw strings (r'...') have symbolic Unicode characters. But it has not supported named Unicode escapes such as r'\N{EM DASH}', making the escapes for string literals and the escapes for regular expressions asymmetric
serhiy-storchaka commentedon Feb 9, 2018
New changeset a445feb by Serhiy Storchaka in branch 'master':
bpo-30688: Support \N{name} escapes in re patterns. (GH-5588)
a445feb
serhiy-storchaka commentedon Feb 9, 2018
Thank you for your contribution Jonathan!
fangyi-zhou commentedon Feb 10, 2018
Hello
This leads to build failures due to circular dependency
At generate-posix-vars stage, unicodedata is imported (due to import pprint)but it has not been built due to it being a C module. However, building C modules happen after generate-posix-vars.
See full message below.
ned-deily commentedon Feb 10, 2018
The buidbots are broken by this. Please fix or revert.
serhiy-storchaka commentedon Feb 10, 2018
New changeset 5df5286 by Serhiy Storchaka (Zhou Fangyi) in branch 'master':
bpo-30688: Import unicodedata only when needed. (GH-5606)
5df5286
serhiy-storchaka commentedon Feb 10, 2018
Thank you Fangyi Zhou for your report and fix. Changes are trivial and didn't require to sign CLA.