[pypy-svn] r78086 - pypy/trunk/pypy/module/_sre

arigo at codespeak.net arigo at codespeak.net
Tue Oct 19 16:56:06 CEST 2010


Author: arigo
Date: Tue Oct 19 16:56:04 2010
New Revision: 78086

Modified:
   pypy/trunk/pypy/module/_sre/interp_sre.py
Log:
Fix translation by making sure that the annotator knows that
"code" is never modified.


Modified: pypy/trunk/pypy/module/_sre/interp_sre.py
==============================================================================
--- pypy/trunk/pypy/module/_sre/interp_sre.py	(original)
+++ pypy/trunk/pypy/module/_sre/interp_sre.py	Tue Oct 19 16:56:04 2010
@@ -290,10 +290,8 @@
 def SRE_Pattern__new__(space, w_subtype, w_pattern, flags, w_code,
               groups=0, w_groupindex=None, w_indexgroup=None):
     n = space.int_w(space.len(w_code))
-    code = [0] * n
-    for i in range(n):
-        x = space.uint_w(space.getitem(w_code, space.wrap(i)))
-        code[i] = intmask(x)
+    code = [intmask(space.uint_w(space.getitem(w_code, space.wrap(i))))
+            for i in range(n)]
     #
     w_srepat = space.allocate_instance(W_SRE_Pattern, w_subtype)
     srepat = space.interp_w(W_SRE_Pattern, w_srepat)



More information about the Pypy-commit mailing list