[pypy-svn] r58273 - in pypy/branch/tuple-nonresizable-395/pypy: interpreter module/_sre module/posix

arigo at codespeak.net arigo at codespeak.net
Sat Sep 20 17:13:19 CEST 2008


Author: arigo
Date: Sat Sep 20 17:13:19 2008
New Revision: 58273

Modified:
   pypy/branch/tuple-nonresizable-395/pypy/interpreter/pycode.py
   pypy/branch/tuple-nonresizable-395/pypy/module/_sre/interp_sre.py
   pypy/branch/tuple-nonresizable-395/pypy/module/posix/interp_posix.py
Log:
Revert r58241, r58250, r58258, r58263: after some discussion, using
listcompr for making fixsized lists is ok.


Modified: pypy/branch/tuple-nonresizable-395/pypy/interpreter/pycode.py
==============================================================================
--- pypy/branch/tuple-nonresizable-395/pypy/interpreter/pycode.py	(original)
+++ pypy/branch/tuple-nonresizable-395/pypy/interpreter/pycode.py	Sat Sep 20 17:13:19 2008
@@ -15,12 +15,8 @@
 
 # helper
 
-def unpack_str_tuple(space, w_str_tuple):
-    items_w = space.viewiterable(w_str_tuple)
-    result = [None] * len(items_w)
-    for i in range(len(items_w)):
-        result[i] = space.str_w(items_w[i])
-    return result
+def unpack_str_tuple(space,w_str_tuple):
+    return [space.str_w(w_el) for w_el in space.unpackiterable(w_str_tuple)]
 
 # code object contants, for co_flags below
 CO_OPTIMIZED    = 0x0001

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 17:13:19 2008
@@ -95,13 +95,10 @@
         """Creates a tuple of index pairs representing matched groups, a format
         that's convenient for SRE_Match."""
         space = self.space
-        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)
+        return space.newtuple([
+            space.newtuple([space.wrap(value1),
+                            space.wrap(value2)])
+            for value1, value2 in self.create_regs(group_count)])
     w_create_regs.unwrap_spec = ['self', int]
 
     def fget_start(space, self):

Modified: pypy/branch/tuple-nonresizable-395/pypy/module/posix/interp_posix.py
==============================================================================
--- pypy/branch/tuple-nonresizable-395/pypy/module/posix/interp_posix.py	(original)
+++ pypy/branch/tuple-nonresizable-395/pypy/module/posix/interp_posix.py	Sat Sep 20 17:13:19 2008
@@ -555,11 +555,7 @@
         r = os.uname()
     except OSError, e:
         raise wrap_oserror(space, e)
-    l_w = [space.wrap(r[0]),
-           space.wrap(r[1]),
-           space.wrap(r[2]),
-           space.wrap(r[3]),
-           space.wrap(r[4])]
+    l_w = [space.wrap(i) for i in [r[0], r[1], r[2], r[3], r[4]]]
     return space.newtuple(l_w)
 uname.unwrap_spec = [ObjSpace]
 



More information about the Pypy-commit mailing list