diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2013-10-24 19:04:37 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2013-10-24 19:04:37 (GMT) |
commit | 8b150ecfc9a57fb2d564381464bb04c9a94ee053 (patch) | |
tree | 51011ee81a175f761a8ebb10a593f6d792945ba2 /Lib | |
parent | e5019d5183041f4f75cf4a30b2dc84eed347425e (diff) | |
parent | be80fc9a843e3c51d1030d3eab52d6287e5aef3a (diff) | |
download | cpython-8b150ecfc9a57fb2d564381464bb04c9a94ee053.zip cpython-8b150ecfc9a57fb2d564381464bb04c9a94ee053.tar.gz cpython-8b150ecfc9a57fb2d564381464bb04c9a94ee053.tar.bz2 |
Issue #19327: Fixed the working of regular expressions with too big charset.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/sre_compile.py | 2 | ||||
-rw-r--r-- | Lib/test/test_re.py | 3 |
2 files changed, 4 insertions, 1 deletions
diff --git a/Lib/sre_compile.py b/Lib/sre_compile.py index d6dc60c..e08ec66 100644 --- a/Lib/sre_compile.py +++ b/Lib/sre_compile.py @@ -339,7 +339,7 @@ def _optimize_unicode(charset, fixup): else: code = 'I' # Convert block indices to byte array of 256 bytes - mapping = array.array('b', mapping).tobytes() + mapping = array.array('B', mapping).tobytes() # 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 841d3a3..5e68585 100644 --- a/Lib/test/test_re.py +++ b/Lib/test/test_re.py @@ -482,6 +482,9 @@ class ReTests(unittest.TestCase): "\u2222").group(1), "\u2222") self.assertEqual(re.match("([\u2222\u2223])", "\u2222", re.UNICODE).group(1), "\u2222") + r = '[%s]' % ''.join(map(chr, range(256, 2**16, 255))) + self.assertEqual(re.match(r, + "\uff01", re.UNICODE).group(), "\uff01") def test_big_codesize(self): # Issue #1160 |