[pypy-svn] r77752 - pypy/branch/fast-forward/lib-python/modified-2.7.0
afa at codespeak.net
afa at codespeak.net
Sun Oct 10 10:46:22 CEST 2010
Author: afa
Date: Sun Oct 10 10:46:20 2010
New Revision: 77752
Added:
pypy/branch/fast-forward/lib-python/modified-2.7.0/pprint.py
- copied, changed from r77751, pypy/branch/fast-forward/lib-python/2.7.0/pprint.py
Log:
unlike CPython, PyPy has real "unbound builtin methods" objects
and dict.__repr__ yields a different object each time.
Copied: pypy/branch/fast-forward/lib-python/modified-2.7.0/pprint.py (from r77751, pypy/branch/fast-forward/lib-python/2.7.0/pprint.py)
==============================================================================
--- pypy/branch/fast-forward/lib-python/2.7.0/pprint.py (original)
+++ pypy/branch/fast-forward/lib-python/modified-2.7.0/pprint.py Sun Oct 10 10:46:20 2010
@@ -144,7 +144,7 @@
return
r = getattr(typ, "__repr__", None)
- if issubclass(typ, dict) and r is dict.__repr__:
+ if issubclass(typ, dict) and r == dict.__repr__:
write('{')
if self._indent_per_level > 1:
write((self._indent_per_level - 1) * ' ')
@@ -173,10 +173,10 @@
write('}')
return
- if ((issubclass(typ, list) and r is list.__repr__) or
- (issubclass(typ, tuple) and r is tuple.__repr__) or
- (issubclass(typ, set) and r is set.__repr__) or
- (issubclass(typ, frozenset) and r is frozenset.__repr__)
+ if ((issubclass(typ, list) and r == list.__repr__) or
+ (issubclass(typ, tuple) and r == tuple.__repr__) or
+ (issubclass(typ, set) and r == set.__repr__) or
+ (issubclass(typ, frozenset) and r == frozenset.__repr__)
):
length = _len(object)
if issubclass(typ, list):
@@ -266,7 +266,7 @@
return ("%s%s%s" % (closure, sio.getvalue(), closure)), True, False
r = getattr(typ, "__repr__", None)
- if issubclass(typ, dict) and r is dict.__repr__:
+ if issubclass(typ, dict) and r == dict.__repr__:
if not object:
return "{}", True, False
objid = _id(object)
@@ -291,8 +291,8 @@
del context[objid]
return "{%s}" % _commajoin(components), readable, recursive
- if (issubclass(typ, list) and r is list.__repr__) or \
- (issubclass(typ, tuple) and r is tuple.__repr__):
+ if (issubclass(typ, list) and r == list.__repr__) or \
+ (issubclass(typ, tuple) and r == tuple.__repr__):
if issubclass(typ, list):
if not object:
return "[]", True, False
More information about the Pypy-commit
mailing list