diff options
Diffstat (limited to 'Lib/string.py')
-rw-r--r-- | Lib/string.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/Lib/string.py b/Lib/string.py index c902007..670c195 100644 --- a/Lib/string.py +++ b/Lib/string.py @@ -78,7 +78,11 @@ class Template(metaclass=_TemplateMetaclass): """A string class for supporting $-substitutions.""" delimiter = '$' - idpattern = r'[_a-z][_a-z0-9]*' + # r'[a-z]' matches to non-ASCII letters when used with IGNORECASE, + # but without ASCII flag. We can't add re.ASCII to flags because of + # backward compatibility. So we use local -i flag and [a-zA-Z] pattern. + # See https://bugs.python.org/issue31672 + idpattern = r'(?-i:[_a-zA-Z][_a-zA-Z0-9]*)' flags = _re.IGNORECASE def __init__(self, template): |