[Python-checkins] cpython (3.4): 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/03d6661c13a0
changeset:   93459:03d6661c13a0
branch:      3.4
parent:      93457:47b3084dd6aa
user:        Serhiy Storchaka <storchaka at gmail.com>
date:        Mon Nov 10 13:24:47 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
@@ -410,8 +410,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