diff options
author | INADA Naoki <methane@users.noreply.github.com> | 2017-10-13 07:02:23 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-13 07:02:23 (GMT) |
commit | b22273ec5d1992b0cbe078b887427ae9977dfb78 (patch) | |
tree | 513406f0548f326404ff00e67f6a7e9093c78dd2 /Misc | |
parent | 925510449984399cf58711843ddfe2e8007c3878 (diff) | |
download | cpython-b22273ec5d1992b0cbe078b887427ae9977dfb78.zip cpython-b22273ec5d1992b0cbe078b887427ae9977dfb78.tar.gz cpython-b22273ec5d1992b0cbe078b887427ae9977dfb78.tar.bz2 |
bpo-31672: Fix string.Template accidentally matched non-ASCII identifiers (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]`.
Diffstat (limited to 'Misc')
-rw-r--r-- | Misc/NEWS.d/next/Library/2017-10-12-02-47-16.bpo-31672.DaOkVd.rst | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/Misc/NEWS.d/next/Library/2017-10-12-02-47-16.bpo-31672.DaOkVd.rst b/Misc/NEWS.d/next/Library/2017-10-12-02-47-16.bpo-31672.DaOkVd.rst new file mode 100644 index 0000000..b8de1f3 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2017-10-12-02-47-16.bpo-31672.DaOkVd.rst @@ -0,0 +1,2 @@ +``idpattern`` in ``string.Template`` matched some non-ASCII characters. Now +it uses ``-i`` regular expression local flag to avoid non-ASCII characters. |