Author: Ronan Lamy <[email protected]>
Branch: var-in-Some
Changeset: r73788:d47b22ad6792
Date: 2014-10-05 04:26 +0100
http://bitbucket.org/pypy/pypy/changeset/d47b22ad6792/
Log: hg merge default
diff --git a/rpython/tool/uid.py b/rpython/tool/uid.py
--- a/rpython/tool/uid.py
+++ b/rpython/tool/uid.py
@@ -1,18 +1,6 @@
-import struct, sys
+import struct
-# This is temporary hack to run PyPy on PyPy
-# until PyPy's struct module handle P format character.
-try:
- HUGEVAL_FMT = 'P'
- HUGEVAL_BYTES = struct.calcsize('P')
-except struct.error:
- if sys.maxint <= 2147483647:
- HUGEVAL_FMT = 'l'
- HUGEVAL_BYTES = 4
- else:
- HUGEVAL_FMT = 'q'
- HUGEVAL_BYTES = 8
-
+HUGEVAL_BYTES = struct.calcsize('P')
HUGEVAL = 256 ** HUGEVAL_BYTES
@@ -21,15 +9,7 @@
result += HUGEVAL
return result
-if sys.version_info < (2, 5):
- def uid(obj):
- """
- Return the id of an object as an unsigned number so that its hex
- representation makes sense
- """
- return fixid(id(obj))
-else:
- uid = id # guaranteed to be positive from CPython 2.5 onwards
+uid = id # guaranteed to be positive from CPython 2.5 onwards
class Hashable(object):
@@ -39,7 +19,7 @@
real hash/compare for immutable ones.
"""
__slots__ = ["key", "value"]
-
+
def __init__(self, value):
self.value = value # a concrete value
# try to be smart about constant mutable or immutable values
@@ -74,7 +54,7 @@
# try to limit the size of the repr to make it more readable
r = repr(self.value)
if (r.startswith('<') and r.endswith('>') and
- hasattr(self.value, '__name__')):
+ hasattr(self.value, '__name__')):
r = '%s %s' % (type(self.value).__name__, self.value.__name__)
elif len(r) > 60 or (len(r) > 30 and type(self.value) is not str):
r = r[:22] + '...' + r[-7:]
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit