[pypy-svn] r12036 - in pypy/dist/pypy: interpreter objspace/std

pedronis at codespeak.net pedronis at codespeak.net
Sat May 7 00:20:24 CEST 2005


Author: pedronis
Date: Sat May  7 00:20:24 2005
New Revision: 12036

Modified:
   pypy/dist/pypy/interpreter/baseobjspace.py
   pypy/dist/pypy/objspace/std/floatobject.py
   pypy/dist/pypy/objspace/std/intobject.py
   pypy/dist/pypy/objspace/std/longobject.py
   pypy/dist/pypy/objspace/std/objspace.py
Log:
Add is_w to the irregular ops so that proxy and trace work after it is short-cut in std objspace.

Done that: added  a short-cut version of is_w to std objspace. 



Modified: pypy/dist/pypy/interpreter/baseobjspace.py
==============================================================================
--- pypy/dist/pypy/interpreter/baseobjspace.py	(original)
+++ pypy/dist/pypy/interpreter/baseobjspace.py	Sat May  7 00:20:24 2005
@@ -526,6 +526,7 @@
     'interpclass_w',
     'unwrap',
     'is_true',
+    'is_w',
     'newtuple',
     'newlist',
     'newstring',

Modified: pypy/dist/pypy/objspace/std/floatobject.py
==============================================================================
--- pypy/dist/pypy/objspace/std/floatobject.py	(original)
+++ pypy/dist/pypy/objspace/std/floatobject.py	Sat May  7 00:20:24 2005
@@ -42,10 +42,7 @@
 # a derived float object, where it should return
 # an exact one.
 def float__Float(space, w_float1):
-    # don't trigger a descr operation.
-    # XXX let's consider to change space.is_ to plain bool
-    #if space.is_true(space.is_(space.type(w_float1), space.w_float)):
-    if space.w_True is space.is_(space.type(w_float1), space.w_float):
+    if space.is_w(space.type(w_float1), space.w_float):
         return w_float1
     a = w_float1.floatval
     return W_FloatObject(space, a)

Modified: pypy/dist/pypy/objspace/std/intobject.py
==============================================================================
--- pypy/dist/pypy/objspace/std/intobject.py	(original)
+++ pypy/dist/pypy/objspace/std/intobject.py	Sat May  7 00:20:24 2005
@@ -390,10 +390,7 @@
 # a derived integer object, where it should return
 # an exact one.
 def int__Int(space, w_int1):
-    # don't trigger a descr operation.
-    # XXX let's consider to change space.is_ to plain bool
-    #if space.is_true(space.is_(space.type(w_int1), space.w_int)):
-    if space.w_True is space.is_(space.type(w_int1), space.w_int):
+    if space.is_w(space.type(w_int1), space.w_int):
         return w_int1
     a = w_int1.intval
     return W_IntObject(space, a)

Modified: pypy/dist/pypy/objspace/std/longobject.py
==============================================================================
--- pypy/dist/pypy/objspace/std/longobject.py	(original)
+++ pypy/dist/pypy/objspace/std/longobject.py	Sat May  7 00:20:24 2005
@@ -103,10 +103,7 @@
 # a derived long object, where it should return
 # an exact one.
 def long__Long(space, w_long1):
-    # don't trigger a descr operation.
-    # XXX let's consider to change space.is_ to plain bool
-    #if space.is_true(space.is_(space.type(w_long1), space.w_long)):
-    if space.w_True is space.is_(space.type(w_long1), space.w_long):
+    if space.is_w(space.type(w_long1), space.w_long):
         return w_long1
     digits = w_long1.digits
     sign = w_long1.sign

Modified: pypy/dist/pypy/objspace/std/objspace.py
==============================================================================
--- pypy/dist/pypy/objspace/std/objspace.py	(original)
+++ pypy/dist/pypy/objspace/std/objspace.py	Sat May  7 00:20:24 2005
@@ -309,6 +309,10 @@
             return self.w_True
         return self.w_False
 
+    # short-cut
+    def is_w(self, w_one, w_two):
+        return w_one is w_two
+
     def is_true(self, w_obj):
         # XXX don't look!
         if isinstance(w_obj, W_DictObject):



More information about the Pypy-commit mailing list