diff options
author | Ezio Melotti <ezio.melotti@gmail.com> | 2013-01-11 06:43:53 (GMT) |
---|---|---|
committer | Ezio Melotti <ezio.melotti@gmail.com> | 2013-01-11 06:43:53 (GMT) |
commit | adfbb8e8ec7c7db027d403a443ca9c00347b987a (patch) | |
tree | d9655554e24391ec86a18d791640b395187cc45c /Lib | |
parent | dc1fa80b6c289f8c9136b00334d49e13096426c8 (diff) | |
parent | fe8e6e741492c496837a48fc04c5c776c8779b32 (diff) | |
download | cpython-adfbb8e8ec7c7db027d403a443ca9c00347b987a.zip cpython-adfbb8e8ec7c7db027d403a443ca9c00347b987a.tar.gz cpython-adfbb8e8ec7c7db027d403a443ca9c00347b987a.tar.bz2 |
#13899: merge with 3.2.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/sre_parse.py | 2 | ||||
-rw-r--r-- | Lib/test/test_re.py | 6 |
2 files changed, 7 insertions, 1 deletions
diff --git a/Lib/sre_parse.py b/Lib/sre_parse.py index 6411475..1298d48 100644 --- a/Lib/sre_parse.py +++ b/Lib/sre_parse.py @@ -245,7 +245,7 @@ def _class_escape(source, escape): if code: return code code = CATEGORIES.get(escape) - if code: + if code and code[0] == IN: return code try: c = escape[1:2] diff --git a/Lib/test/test_re.py b/Lib/test/test_re.py index b945203..feae7c5 100644 --- a/Lib/test/test_re.py +++ b/Lib/test/test_re.py @@ -949,6 +949,12 @@ class ReTests(unittest.TestCase): # Test behaviour when not given a string or pattern as parameter self.assertRaises(TypeError, re.compile, 0) + def test_bug_13899(self): + # Issue #13899: re pattern r"[\A]" should work like "A" but matches + # nothing. Ditto B and Z. + self.assertEqual(re.findall(r'[\A\B\b\C\Z]', 'AB\bCZ'), + ['A', 'B', '\b', 'C', 'Z']) + @bigmemtest(size=_2G, memuse=1) def test_large_search(self, size): # Issue #10182: indices were 32-bit-truncated. |