ATen
ATen copied to clipboard
code_template.py substitution string still fails on Python 2.7.5
Here is a self-contained repro:
[[email protected] ~/local/c2isl/third-party/pytorch] python --version
Python 2.7.5
[[email protected] ~/local/c2isl/third-party/pytorch] python foo.py
Traceback (most recent call last):
File "foo.py", line 3, in <module>
re.compile(x, re.MULTILINE)
File "/usr/lib64/python2.7/re.py", line 190, in compile
return _compile(pattern, flags)
File "/usr/lib64/python2.7/re.py", line 242, in _compile
raise error, v # invalid expression
sre_constants.error: nothing to repeat
[[email protected] ~/local/c2isl/third-party/pytorch] cat foo.py
import re
x = "(^[^\n\S]*)?\$([^\d\W][a-zA-Z0-9_]*|\{,?[^\d\W][a-zA-Z0-9_]*\,?})"
re.compile(x, re.MULTILINE)
The problem is this version of Python does not understand (x*)?
.