Commit 22fb0dec authored by Serhiy Storchaka's avatar Serhiy Storchaka

Issue #19327: Fixed the working of regular expressions with too big charset.

parent 2147857d
...@@ -343,7 +343,7 @@ def _optimize_unicode(charset, fixup): ...@@ -343,7 +343,7 @@ def _optimize_unicode(charset, fixup):
else: else:
code = 'I' code = 'I'
# Convert block indices to byte array of 256 bytes # Convert block indices to byte array of 256 bytes
mapping = array.array('b', mapping).tostring() mapping = array.array('B', mapping).tostring()
# Convert byte array to word array # Convert byte array to word array
mapping = array.array(code, mapping) mapping = array.array(code, mapping)
assert mapping.itemsize == _sre.CODESIZE assert mapping.itemsize == _sre.CODESIZE
......
...@@ -427,6 +427,8 @@ class ReTests(unittest.TestCase): ...@@ -427,6 +427,8 @@ class ReTests(unittest.TestCase):
u"\u2222").group(1), u"\u2222") u"\u2222").group(1), u"\u2222")
self.assertEqual(re.match(u"([\u2222\u2223])", self.assertEqual(re.match(u"([\u2222\u2223])",
u"\u2222", re.UNICODE).group(1), u"\u2222") u"\u2222", re.UNICODE).group(1), u"\u2222")
r = u'[%s]' % u''.join(map(unichr, range(256, 2**16, 255)))
self.assertEqual(re.match(r, u"\uff01", re.UNICODE).group(), u"\uff01")
def test_big_codesize(self): def test_big_codesize(self):
# Issue #1160 # Issue #1160
......
...@@ -40,6 +40,8 @@ Core and Builtins ...@@ -40,6 +40,8 @@ Core and Builtins
Library Library
------- -------
- Issue #19327: Fixed the working of regular expressions with too big charset.
- Issue #19350: Increasing the test coverage of macurl2path. Patch by Colin - Issue #19350: Increasing the test coverage of macurl2path. Patch by Colin
Williams. Williams.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment