Issue #22031: Reprs now always use hexadecimal format with the "0x" prefix

when contain an id in form " at 0x...".
This commit is contained in:
Serhiy Storchaka 2014-07-22 12:14:52 +03:00
parent fbc877b794
commit 0c937b3ed6
8 changed files with 19 additions and 8 deletions

View file

@ -144,7 +144,7 @@ class WeakValueDictionary(collections.MutableMapping):
return o is not None
def __repr__(self):
return "<WeakValueDictionary at %s>" % id(self)
return "<WeakValueDictionary at %#x>" % id(self)
def __setitem__(self, key, value):
if self._pending_removals:
@ -348,7 +348,7 @@ class WeakKeyDictionary(collections.MutableMapping):
return len(self.data) - len(self._pending_removals)
def __repr__(self):
return "<WeakKeyDictionary at %s>" % id(self)
return "<WeakKeyDictionary at %#x>" % id(self)
def __setitem__(self, key, value):
self.data[ref(key, self._remove)] = value