[pypy-svn] r50370 - in pypy/dist/pypy: module/posix objspace/std translator/goal

arigo at codespeak.net arigo at codespeak.net
Sun Jan 6 13:22:30 CET 2008


Author: arigo
Date: Sun Jan  6 13:22:28 2008
New Revision: 50370

Modified:
   pypy/dist/pypy/module/posix/interp_posix.py
   pypy/dist/pypy/objspace/std/smallintobject.py
   pypy/dist/pypy/translator/goal/ann_override.py
Log:
Annotation fixes: don't use space.wrap(tuple).


Modified: pypy/dist/pypy/module/posix/interp_posix.py
==============================================================================
--- pypy/dist/pypy/module/posix/interp_posix.py	(original)
+++ pypy/dist/pypy/module/posix/interp_posix.py	Sun Jan  6 13:22:28 2008
@@ -207,7 +207,11 @@
     except OSError, e:
         raise wrap_oserror(space, e)
     else:
-        return space.wrap(times)
+        return space.newtuple([space.wrap(times[0]),
+                               space.wrap(times[1]),
+                               space.wrap(times[2]),
+                               space.wrap(times[3]),
+                               space.wrap(times[4])])
 times.unwrap_spec = [ObjSpace]
 
 def system(space, cmd):

Modified: pypy/dist/pypy/objspace/std/smallintobject.py
==============================================================================
--- pypy/dist/pypy/objspace/std/smallintobject.py	(original)
+++ pypy/dist/pypy/objspace/std/smallintobject.py	Sun Jan  6 13:22:28 2008
@@ -181,7 +181,7 @@
                                 space.wrap("integer modulo"))
     # no overflow possible
     m = x % y
-    return space.wrap((z,m))
+    return space.newtuple([space.wrap(z), space.wrap(m)])
 
 def div__SmallInt_SmallInt(space, w_int1, w_int2):
     return _floordiv(space, w_int1, w_int2)

Modified: pypy/dist/pypy/translator/goal/ann_override.py
==============================================================================
--- pypy/dist/pypy/translator/goal/ann_override.py	(original)
+++ pypy/dist/pypy/translator/goal/ann_override.py	Sun Jan  6 13:22:28 2008
@@ -52,6 +52,9 @@
             typ = Wrappable
         else:
             assert not issubclass(typ, Wrappable)
+            assert typ != tuple, "space.wrap(tuple) forbidden; use newtuple()"
+            assert typ != list, "space.wrap(list) forbidden; use newlist()"
+            assert typ != dict, "space.wrap(dict) forbidden; use newdict()"
             if args_s[0].is_constant() and args_s[1].is_constant():
                 if typ in (str, bool, int, float):
                     space = args_s[0].const



More information about the Pypy-commit mailing list