Author: Armin Rigo <[email protected]>
Branch: release-2.0.x
Changeset: r64119:128e78d6a11a
Date: 2013-05-15 10:29 +0200
http://bitbucket.org/pypy/pypy/changeset/128e78d6a11a/

Log:    Like CPython, avoid returning negative numbers in "id()". We might
        still return negative numbers for id() of
        ints/longs/floats/complexes but I'm not sure we care too much about
        that.

diff --git a/pypy/interpreter/baseobjspace.py b/pypy/interpreter/baseobjspace.py
--- a/pypy/interpreter/baseobjspace.py
+++ b/pypy/interpreter/baseobjspace.py
@@ -666,7 +666,8 @@
     def id(self, w_obj):
         w_result = w_obj.immutable_unique_id(self)
         if w_result is None:
-            w_result = self.wrap(compute_unique_id(w_obj))
+            # in the common case, returns an unsigned value
+            w_result = self.wrap(r_uint(compute_unique_id(w_obj)))
         return w_result
 
     def hash_w(self, w_obj):
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to