diff options
author | Ezio Melotti <ezio.melotti@gmail.com> | 2013-01-11 08:44:25 +0200 |
---|---|---|
committer | Ezio Melotti <ezio.melotti@gmail.com> | 2013-01-11 08:44:25 +0200 |
commit | ee46b6c5c485025a61b34a27b6235242f16b8686 (patch) | |
tree | 5eeacb8179afcc97b0f318ef74a0b0ebba5c32ef | |
parent | 2645936e278e0f034701db2c3378af1da589e628 (diff) | |
parent | adfbb8e8ec7c7db027d403a443ca9c00347b987a (diff) | |
download | cpython-git-ee46b6c5c485025a61b34a27b6235242f16b8686.tar.gz |
#13899: merge with 3.3.
-rw-r--r-- | Lib/sre_parse.py | 2 | ||||
-rw-r--r-- | Lib/test/test_re.py | 6 | ||||
-rw-r--r-- | Misc/NEWS | 3 |
3 files changed, 10 insertions, 1 deletions
diff --git a/Lib/sre_parse.py b/Lib/sre_parse.py index 6411475ac2..1298d48e6d 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 b945203633..feae7c5507 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. @@ -214,6 +214,9 @@ Library - Issue #16900: Issue a ResourceWarning when an ssl socket is left unclosed. +- Issue #13899: \A, \Z, and \B now correctly match the A, Z, and B literals + when used inside character classes (e.g. '[\A]'). Patch by Matthew Barnett. + - Issue #15545: Fix regression in sqlite3's iterdump method where it was failing if the connection used a row factory (such as sqlite3.Row) that produced unsortable objects. (Regression was introduced by fix for 9750). |