[Python-checkins] cpython (merge 3.4 -> default): Got rid of the array module dependency in the re module.

serhiy.storchaka python-checkins at python.org
Mon Nov 10 12:27:36 CET 2014


https://hg.python.org/cpython/rev/3c3cf26e6f7d
changeset:   93460:3c3cf26e6f7d
parent:      93458:09ec09cfe539
parent:      93459:03d6661c13a0
user:        Serhiy Storchaka <storchaka at gmail.com>
date:        Mon Nov 10 13:25:14 2014 +0200
summary:
  Got rid of the array module dependency in the re module.
The re module could be used during building before array is built.

files:
  Lib/sre_compile.py |  3 +--
  1 files changed, 1 insertions(+), 2 deletions(-)


diff --git a/Lib/sre_compile.py b/Lib/sre_compile.py
--- a/Lib/sre_compile.py
+++ b/Lib/sre_compile.py
@@ -382,8 +382,7 @@
 
 def _bytes_to_codes(b):
     # Convert block indices to word array
-    import array
-    a = array.array('I', b)
+    a = memoryview(b).cast('I')
     assert a.itemsize == _sre.CODESIZE
     assert len(a) * a.itemsize == len(b)
     return a.tolist()

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list