diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2013-10-24 19:02:42 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2013-10-24 19:02:42 (GMT) |
commit | 22fb0dec30af4168c81744782a8bcc2453ac8055 (patch) | |
tree | 0daf6e478012eda3a71a9c44f6d5f7e6ad70a920 | |
parent | 2147857db3f0ac3ff0200e52c930ed5ef43c2bfd (diff) | |
download | cpython-22fb0dec30af4168c81744782a8bcc2453ac8055.zip cpython-22fb0dec30af4168c81744782a8bcc2453ac8055.tar.gz cpython-22fb0dec30af4168c81744782a8bcc2453ac8055.tar.bz2 |
Issue #19327: Fixed the working of regular expressions with too big charset.
-rw-r--r-- | Lib/sre_compile.py | 2 | ||||
-rw-r--r-- | Lib/test/test_re.py | 2 | ||||
-rw-r--r-- | Misc/NEWS | 2 |
3 files changed, 5 insertions, 1 deletions
diff --git a/Lib/sre_compile.py b/Lib/sre_compile.py index 97c1663..bd40705 100644 --- a/Lib/sre_compile.py +++ b/Lib/sre_compile.py @@ -343,7 +343,7 @@ def _optimize_unicode(charset, fixup): else: code = 'I' # 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 mapping = array.array(code, mapping) assert mapping.itemsize == _sre.CODESIZE diff --git a/Lib/test/test_re.py b/Lib/test/test_re.py index 8b277cf..d879bac 100644 --- a/Lib/test/test_re.py +++ b/Lib/test/test_re.py @@ -427,6 +427,8 @@ class ReTests(unittest.TestCase): u"\u2222").group(1), u"\u2222") self.assertEqual(re.match(u"([\u2222\u2223])", 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): # Issue #1160 @@ -40,6 +40,8 @@ Core and Builtins Library ------- +- Issue #19327: Fixed the working of regular expressions with too big charset. + - Issue #19350: Increasing the test coverage of macurl2path. Patch by Colin Williams. |