Author: Amaury Forgeot d'Arc <amaur...@gmail.com>
Branch: py3.5
Changeset: r90928:302d39bda33c
Date: 2017-04-02 21:41 +0200
http://bitbucket.org/pypy/pypy/changeset/302d39bda33c/

Log:    Restore support for _sre.CODESIZE=2 that was present in Python 2.7

diff --git a/lib-python/3/sre_compile.py b/lib-python/3/sre_compile.py
--- a/lib-python/3/sre_compile.py
+++ b/lib-python/3/sre_compile.py
@@ -378,7 +378,11 @@
 
 def _bytes_to_codes(b):
     # Convert block indices to word array
-    a = memoryview(b).cast('I')
+    if _sre.CODESIZE == 2:
+        code = 'H'
+    else:
+        code = 'I'
+    a = memoryview(b).cast(code)
     assert a.itemsize == _sre.CODESIZE
     assert len(a) * a.itemsize == len(b)
     return a.tolist()
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to