Skip to content

Commit

Permalink
python#13899: merge with 3.2.
Browse files Browse the repository at this point in the history
  • Loading branch information
ezio-melotti committed Jan 11, 2013
2 parents dc1fa80 + fe8e6e7 commit adfbb8e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Lib/sre_parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
6 changes: 6 additions & 0 deletions Lib/test/test_re.py
Original file line number Diff line number Diff line change
Expand Up @@ -949,6 +949,12 @@ def test_compile(self):
# 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.
Expand Down
3 changes: 3 additions & 0 deletions Misc/NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,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).
Expand Down

0 comments on commit adfbb8e

Please sign in to comment.