diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2018-01-04 17:20:11 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-04 17:20:11 (GMT) |
commit | 87be28f4a1c5b76926c71a3d9f92503f9eb82d51 (patch) | |
tree | d11b0f8de8a5b788e52d8fa2b08646e76e2093bf /Lib/string.py | |
parent | 78e24d4415c37e9e9951920bc31e9ee4868d86cb (diff) | |
download | cpython-87be28f4a1c5b76926c71a3d9f92503f9eb82d51.zip cpython-87be28f4a1c5b76926c71a3d9f92503f9eb82d51.tar.gz cpython-87be28f4a1c5b76926c71a3d9f92503f9eb82d51.tar.bz2 |
bpo-31672: Restore the former behavior when override flags in Template. (#5099)
Overriding flags to 0 will make the default pattern matching only
lower case letters.
Diffstat (limited to 'Lib/string.py')
-rw-r--r-- | Lib/string.py | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/Lib/string.py b/Lib/string.py index fd4b1f7..b9d6f5e 100644 --- a/Lib/string.py +++ b/Lib/string.py @@ -82,11 +82,8 @@ class Template(metaclass=_TemplateMetaclass): # 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'(?a:[_a-zA-Z][_a-zA-Z0-9]*)' + idpattern = r'(?a:[_a-z][_a-z0-9]*)' braceidpattern = None flags = _re.IGNORECASE |