mirror of
https://github.com/python/cpython.git
synced 2025-08-30 05:35:08 +00:00
#2650: re.escape() no longer escapes the "_".
This commit is contained in:
parent
344d26c7a0
commit
88fdeb45ef
4 changed files with 15 additions and 8 deletions
|
@ -428,7 +428,7 @@ class ReTests(unittest.TestCase):
|
|||
self.assertEqual(m.span(), span)
|
||||
|
||||
def test_re_escape(self):
|
||||
alnum_chars = string.ascii_letters + string.digits
|
||||
alnum_chars = string.ascii_letters + string.digits + '_'
|
||||
p = ''.join(chr(i) for i in range(256))
|
||||
for c in p:
|
||||
if c in alnum_chars:
|
||||
|
@ -441,7 +441,7 @@ class ReTests(unittest.TestCase):
|
|||
self.assertMatch(re.escape(p), p)
|
||||
|
||||
def test_re_escape_byte(self):
|
||||
alnum_chars = (string.ascii_letters + string.digits).encode('ascii')
|
||||
alnum_chars = (string.ascii_letters + string.digits + '_').encode('ascii')
|
||||
p = bytes(range(256))
|
||||
for i in p:
|
||||
b = bytes([i])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue