bpo-31672: string: Use `re.A | re.I` flag for identifier pattern by methane · Pull Request #3872 · python/cpython

@methane methane changed the title bpo-31672: strings.Template should use re.A flag bpo-31672: string: Use re.A | re.I flag for identifier pattern

Oct 3, 2017

@methane

As documented, identifier should be ASCII.
Since we forgot re.A flag, it matched to some non ASCII characters.

For backward compatibility, we need to remove re.A flag after
pattern is compiled.

warsaw

@methane

@methane

@methane

warsaw

serhiy-storchaka

@methane

serhiy-storchaka

@methane

@methane

serhiy-storchaka

methane added a commit to methane/cpython that referenced this pull request

Oct 13, 2017
…dentifiers (pythonGH-3872)

Pattern `[a-z]` with `IGNORECASE` flag can match to some non-ASCII characters.

Straightforward solution for this is using `IGNORECASE | ASCII` flag.
But users may subclass `Template` and override only `idpattern`. So we want to
avoid changing `Template.flags`.

So this commit uses local flag `-i` for `idpattern` and change `[a-z]` to `[a-zA-Z]`..
(cherry picked from commit b22273e)

@methane methane deleted the string-template-ascii branch

October 13, 2017 07:31

methane added a commit that referenced this pull request

Oct 14, 2017
…iers (GH-3872)

Pattern `[a-z]` with `IGNORECASE` flag can match to some non-ASCII characters.

Straightforward solution for this is using `IGNORECASE | ASCII` flag.
But users may subclass `Template` and override only `idpattern`. So we want to
avoid changing `Template.flags`.

So this commit uses local flag `-i` for `idpattern` and change `[a-z]` to `[a-zA-Z]`.
(cherry picked from commit b22273e)