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.
This commit is contained in:
Serhiy Storchaka 2018-01-04 19:20:11 +02:00 • committed by GitHub
parent 78e24d4415
commit 87be28f4a1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 11 deletions

View file

@ -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