mirror of
https://github.com/python/cpython.git
synced 2025-09-25 01:43:11 +00:00
#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.
This commit is contained in:
parent
32851d61f2
commit
5c4e32b131
4 changed files with 11 additions and 1 deletions
|
@ -228,7 +228,7 @@ def _class_escape(source, escape):
|
||||||
if code:
|
if code:
|
||||||
return code
|
return code
|
||||||
code = CATEGORIES.get(escape)
|
code = CATEGORIES.get(escape)
|
||||||
if code:
|
if code and code[0] == IN:
|
||||||
return code
|
return code
|
||||||
try:
|
try:
|
||||||
c = escape[1:2]
|
c = escape[1:2]
|
||||||
|
|
|
@ -821,6 +821,12 @@ class ReTests(unittest.TestCase):
|
||||||
# Test behaviour when not given a string or pattern as parameter
|
# Test behaviour when not given a string or pattern as parameter
|
||||||
self.assertRaises(TypeError, re.compile, 0)
|
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'])
|
||||||
|
|
||||||
@precisionbigmemtest(size=_2G, memuse=1)
|
@precisionbigmemtest(size=_2G, memuse=1)
|
||||||
def test_large_search(self, size):
|
def test_large_search(self, size):
|
||||||
# Issue #10182: indices were 32-bit-truncated.
|
# Issue #10182: indices were 32-bit-truncated.
|
||||||
|
|
|
@ -58,6 +58,7 @@ Chris Barker
|
||||||
Anton Barkovsky
|
Anton Barkovsky
|
||||||
Nick Barnes
|
Nick Barnes
|
||||||
Quentin Barnes
|
Quentin Barnes
|
||||||
|
Matthew Barnett
|
||||||
Richard Barran
|
Richard Barran
|
||||||
Cesar Eduardo Barros
|
Cesar Eduardo Barros
|
||||||
Des Barry
|
Des Barry
|
||||||
|
|
|
@ -186,6 +186,9 @@ Core and Builtins
|
||||||
Library
|
Library
|
||||||
-------
|
-------
|
||||||
|
|
||||||
|
- 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 #15109: Fix regression in sqlite3's iterdump method where it would
|
- Issue #15109: Fix regression in sqlite3's iterdump method where it would
|
||||||
die with an encoding error if the database contained string values
|
die with an encoding error if the database contained string values
|
||||||
containing non-ASCII. (Regression was introduced by fix for 9750).
|
containing non-ASCII. (Regression was introduced by fix for 9750).
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue