[pypy-svn] r58043 - in pypy/branch/tuple-nonresizable-395/pypy: module/rctime objspace/std

fijal at codespeak.net fijal at codespeak.net
Wed Sep 10 18:56:04 CEST 2008


Author: fijal
Date: Wed Sep 10 18:56:01 2008
New Revision: 58043

Modified:
   pypy/branch/tuple-nonresizable-395/pypy/module/rctime/interp_time.py
   pypy/branch/tuple-nonresizable-395/pypy/objspace/std/marshal_impl.py
Log:
Few other sources of merge between tuple and list wrappeditems


Modified: pypy/branch/tuple-nonresizable-395/pypy/module/rctime/interp_time.py
==============================================================================
--- pypy/branch/tuple-nonresizable-395/pypy/module/rctime/interp_time.py	(original)
+++ pypy/branch/tuple-nonresizable-395/pypy/module/rctime/interp_time.py	Wed Sep 10 18:56:01 2008
@@ -166,17 +166,16 @@
     return rffi.r_time_t(seconds)
 
 def _tm_to_tuple(space, t):
-    time_tuple = []
-
-    time_tuple.append(space.wrap(rffi.getintfield(t, 'c_tm_year') + 1900))
-    time_tuple.append(space.wrap(rffi.getintfield(t, 'c_tm_mon') + 1)) # want january == 1
-    time_tuple.append(space.wrap(rffi.getintfield(t, 'c_tm_mday')) )
-    time_tuple.append(space.wrap(rffi.getintfield(t, 'c_tm_hour')) )
-    time_tuple.append(space.wrap(rffi.getintfield(t, 'c_tm_min')) )
-    time_tuple.append(space.wrap(rffi.getintfield(t, 'c_tm_sec')) )
-    time_tuple.append(space.wrap((rffi.getintfield(t, 'c_tm_wday') + 6) % 7)) # want monday == 0
-    time_tuple.append(space.wrap(rffi.getintfield(t, 'c_tm_yday') + 1)) # want january, 1 == 1
-    time_tuple.append(space.wrap(rffi.getintfield(t, 'c_tm_isdst')) )
+    time_tuple = [
+        space.wrap(rffi.getintfield(t, 'c_tm_year') + 1900),
+        space.wrap(rffi.getintfield(t, 'c_tm_mon') + 1), # want january == 1
+        space.wrap(rffi.getintfield(t, 'c_tm_mday')),
+        space.wrap(rffi.getintfield(t, 'c_tm_hour')),
+        space.wrap(rffi.getintfield(t, 'c_tm_min')),
+        space.wrap(rffi.getintfield(t, 'c_tm_sec')),
+        space.wrap((rffi.getintfield(t, 'c_tm_wday') + 6) % 7), # want monday == 0
+        space.wrap(rffi.getintfield(t, 'c_tm_yday') + 1), # want january, 1 == 1
+        space.wrap(rffi.getintfield(t, 'c_tm_isdst'))]
     
     w_struct_time = _get_module_object(space, 'struct_time')
     w_time_tuple = space.newtuple(time_tuple)

Modified: pypy/branch/tuple-nonresizable-395/pypy/objspace/std/marshal_impl.py
==============================================================================
--- pypy/branch/tuple-nonresizable-395/pypy/objspace/std/marshal_impl.py	(original)
+++ pypy/branch/tuple-nonresizable-395/pypy/objspace/std/marshal_impl.py	Wed Sep 10 18:56:01 2008
@@ -379,7 +379,7 @@
     m.put_int(x.co_flags)
     m.atom_str(TYPE_STRING, x.co_code)
     m.start(TYPE_TUPLE)
-    m.put_list_w(x.co_consts_w, len(x.co_consts_w))
+    m.put_list_w(x.co_consts_w[:], len(x.co_consts_w))
     m.atom_strlist(TYPE_TUPLE, TYPE_INTERNED, [space.str_w(w_name) for w_name in x.co_names_w])
     m.atom_strlist(TYPE_TUPLE, TYPE_INTERNED, x.co_varnames)
     m.atom_strlist(TYPE_TUPLE, TYPE_INTERNED, x.co_freevars)
@@ -422,7 +422,8 @@
     flags       = u.get_int()
     code        = unmarshal_str(u)
     u.start(TYPE_TUPLE)
-    consts_w    = u.get_list_w()
+    consts_w    = u.get_tuple_w()
+    # copy in order not to merge it with anything else
     names       = unmarshal_strlist(u, TYPE_TUPLE)
     varnames    = unmarshal_strlist(u, TYPE_TUPLE)
     freevars    = unmarshal_strlist(u, TYPE_TUPLE)



More information about the Pypy-commit mailing list