[pypy-commit] pypy kill-unary-multimethods: remove id as multimethod

fijal noreply at buildbot.pypy.org
Thu Sep 22 15:10:31 CEST 2011

Author: Maciej Fijalkowski <fijall at gmail.com>
Branch: kill-unary-multimethods
Changeset: r47391:30254a57e7d9
Date: 2011-09-21 10:19 +0200

Log:	remove id as multimethod

diff --git a/pypy/interpreter/baseobjspace.py b/pypy/interpreter/baseobjspace.py
--- a/pypy/interpreter/baseobjspace.py
+++ b/pypy/interpreter/baseobjspace.py
@@ -8,7 +8,7 @@
 from pypy.interpreter.miscutils import ThreadLocals
 from pypy.tool.cache import Cache
 from pypy.tool.uid import HUGEVAL_BYTES
-from pypy.rlib.objectmodel import we_are_translated, newlist
+from pypy.rlib.objectmodel import we_are_translated, newlist, compute_unique_id
 from pypy.rlib.debug import make_sure_not_resized
 from pypy.rlib.timer import DummyTimer, Timer
 from pypy.rlib.rarithmetic import r_uint
@@ -958,6 +958,9 @@
     def isinstance_w(self, w_obj, w_type):
         return self.is_true(self.isinstance(w_obj, w_type))
+    def id(self, w_obj):
+        return self.wrap(compute_unique_id(w_obj))
     # The code below only works
     # for the simple case (new-style instance).
     # These methods are patched with the full logic by the __builtin__
diff --git a/pypy/objspace/std/default.py b/pypy/objspace/std/default.py
--- a/pypy/objspace/std/default.py
+++ b/pypy/objspace/std/default.py
@@ -2,16 +2,8 @@
 from pypy.interpreter.error import OperationError, typed_unwrap_error_msg
 from pypy.objspace.std.register_all import register_all
-from pypy.rlib import objectmodel
-# The following default implementations are used before delegation is tried.
-# 'id' is normally the address of the wrapper.
-def id__ANY(space, w_obj):
-    #print 'id:', w_obj
-    return space.wrap(objectmodel.compute_unique_id(w_obj))
 # __init__ should succeed if called internally as a multimethod
 def init__ANY(space, w_obj, __args__):

More information about the pypy-commit mailing list