[pypy-svn] r58250 - pypy/branch/tuple-nonresizable-395/pypy/module/_sre

arigo at codespeak.net arigo at codespeak.net
Sat Sep 20 12:07:56 CEST 2008


Author: arigo
Date: Sat Sep 20 12:07:56 2008
New Revision: 58250

Modified:
   pypy/branch/tuple-nonresizable-395/pypy/module/_sre/interp_sre.py
Log:
Seems that --listcompr doesn't quite work as I expect it to.  Anyway I
fear we should not _depend_ on listcompr for annotating PyPy.  For now
let's rewrite this in a way that doesn't depend on listcompr; another
solution would be to only call make_sure_not_resized() if listcompr is
enabled.



Modified: pypy/branch/tuple-nonresizable-395/pypy/module/_sre/interp_sre.py
==============================================================================
--- pypy/branch/tuple-nonresizable-395/pypy/module/_sre/interp_sre.py	(original)
+++ pypy/branch/tuple-nonresizable-395/pypy/module/_sre/interp_sre.py	Sat Sep 20 12:07:56 2008
@@ -95,10 +95,12 @@
         """Creates a tuple of index pairs representing matched groups, a format
         that's convenient for SRE_Match."""
         space = self.space
-        lst = []
-        for value1, value2 in self.create_regs(group_count):
-            lst.append(space.newtuple([space.wrap(value1),
-                                       space.wrap(value2)]))
+        regs = self.create_regs(group_count)
+        lst = [None] * len(regs)
+        for i in range(len(regs)):
+            value1, value2 = regs[i]
+            lst[i] = space.newtuple([space.wrap(value1),
+                                     space.wrap(value2)])
         return space.newtuple(lst)
     w_create_regs.unwrap_spec = ['self', int]
 



More information about the Pypy-commit mailing list