diff options
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/sre_compile.py | 1 | ||||
-rwxr-xr-x | Lib/test/test_array.py | 4 |
2 files changed, 5 insertions, 0 deletions
diff --git a/Lib/sre_compile.py b/Lib/sre_compile.py index 6b28052..5b66084 100644 --- a/Lib/sre_compile.py +++ b/Lib/sre_compile.py @@ -353,6 +353,7 @@ def _optimize_unicode(charset, fixup): # Convert byte array to word array mapping = array.array(code, mapping) assert mapping.itemsize == _sre.CODESIZE + assert len(mapping) * mapping.itemsize == 256 header = header + mapping.tolist() data[0:0] = header return [(BIGCHARSET, data)] diff --git a/Lib/test/test_array.py b/Lib/test/test_array.py index 9b11edf..cf5c2e8 100755 --- a/Lib/test/test_array.py +++ b/Lib/test/test_array.py @@ -700,6 +700,10 @@ class BaseTest(unittest.TestCase): # SF bug #1486663 -- this used to erroneously raise a TypeError ArraySubclassWithKwargs('b', newarg=1) + def test_create_from_bytes(self): + a = array.array('H', b"1234") + self.assertEqual(len(a) * a.itemsize, 4) + class StringTest(BaseTest): |