[Python-checkins] cpython (2.7): Issue #19327: Fixed the working of regular expressions with too big charset.
serhiy.storchaka
python-checkins at python.org
Thu Oct 24 21:05:08 CEST 2013
http://hg.python.org/cpython/rev/d2bb0da45c93
changeset: 86599:d2bb0da45c93
branch: 2.7
parent: 86595:5fda64d39540
user: Serhiy Storchaka <storchaka at gmail.com>
date: Thu Oct 24 22:02:42 2013 +0300
summary:
Issue #19327: Fixed the working of regular expressions with too big charset.
files:
Lib/sre_compile.py | 2 +-
Lib/test/test_re.py | 2 ++
Misc/NEWS | 2 ++
3 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/Lib/sre_compile.py b/Lib/sre_compile.py
--- a/Lib/sre_compile.py
+++ b/Lib/sre_compile.py
@@ -343,7 +343,7 @@
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
--- a/Lib/test/test_re.py
+++ b/Lib/test/test_re.py
@@ -427,6 +427,8 @@
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
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -40,6 +40,8 @@
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.
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list