]> granicus.if.org Git - python/commit
bpo-31672: Fix string.Template accidentally matched non-ASCII identifiers (GH-3872)
authorINADA Naoki <methane@users.noreply.github.com>
Sat, 14 Oct 2017 05:21:59 +0000 (14:21 +0900)
committerGitHub <noreply@github.com>
Sat, 14 Oct 2017 05:21:59 +0000 (14:21 +0900)
commit7060380d577690a40ebc201c0725076349e977cd
tree792fe8b9f5a18ff8680f13d03ae27b0544e0fce1
parent6234e9068332f61f935cf13fa5b1a924a99c28b2
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]`.
(cherry picked from commit b22273ec5d1992b0cbe078b887427ae9977dfb78)
Doc/library/string.rst
Lib/string.py
Lib/test/test_string.py
Misc/NEWS.d/next/Library/2017-10-12-02-47-16.bpo-31672.DaOkVd.rst [new file with mode: 0644]