diff options
author | Barry Warsaw <barry@python.org> | 2017-11-21 15:28:13 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-11-21 15:28:13 (GMT) |
commit | e256b408889eba867e1d90e5e1a0904843256255 (patch) | |
tree | 3bbec9153c33ddd4eb95ceb19ae3b244e9490438 /Lib/string.py | |
parent | 337cbbace0a43f50fcd33ea4d3b7cb30733237db (diff) | |
download | cpython-e256b408889eba867e1d90e5e1a0904843256255.zip cpython-e256b408889eba867e1d90e5e1a0904843256255.tar.gz cpython-e256b408889eba867e1d90e5e1a0904843256255.tar.bz2 |
bpo-31672 - Add one last minor clarification for idpattern (#4483)
Add one last minor clarification for idpattern
Diffstat (limited to 'Lib/string.py')
-rw-r--r-- | Lib/string.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/Lib/string.py b/Lib/string.py index a3e6d91..fd4b1f7 100644 --- a/Lib/string.py +++ b/Lib/string.py @@ -79,11 +79,14 @@ class Template(metaclass=_TemplateMetaclass): """A string class for supporting $-substitutions.""" delimiter = '$' - # 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. + # r'[a-z]' matches to non-ASCII letters when used with IGNORECASE, but + # without the ASCII flag. We can't add re.ASCII to flags because of + # backward compatibility. So we use the ?a local flag and [a-z] pattern. + # We also can't remove the A-Z ranges, because although they are + # technically redundant with the IGNORECASE flag, the value is part of the + # publicly documented API. # See https://bugs.python.org/issue31672 - idpattern = r'(?-i:[_a-zA-Z][_a-zA-Z0-9]*)' + idpattern = r'(?a:[_a-zA-Z][_a-zA-Z0-9]*)' braceidpattern = None flags = _re.IGNORECASE |