diff --git a/immutables/_map.c b/immutables/_map.c index 9f0a5866..7e510fd1 100644 --- a/immutables/_map.c +++ b/immutables/_map.c @@ -3194,14 +3194,14 @@ map_py_repr(BaseMapObject *m) if (MapMutation_Check(m)) { if (_PyUnicodeWriter_WriteASCIIString( - &writer, "", m); - if (addr == NULL) { - goto error; - } - if (_PyUnicodeWriter_WriteStr(&writer, addr) < 0) { - Py_DECREF(addr); - goto error; - } - Py_DECREF(addr); - Py_ReprLeave((PyObject *)m); return _PyUnicodeWriter_Finish(&writer); diff --git a/immutables/map.py b/immutables/map.py index 7c16139d..fe9dbaf3 100644 --- a/immutables/map.py +++ b/immutables/map.py @@ -649,8 +649,7 @@ def __repr__(self): items = [] for key, val in self.items(): items.append("{!r}: {!r}".format(key, val)) - return ''.format( - ', '.join(items), id(self)) + return 'immutables.Map({{{}}})'.format(', '.join(items)) def __dump__(self): # pragma: no cover buf = [] @@ -818,8 +817,7 @@ def __repr__(self): items = [] for key, val in self.__root.items(): items.append("{!r}: {!r}".format(key, val)) - return ''.format( - ', '.join(items), id(self)) + return 'immutables.MapMutation({{{}}})'.format(', '.join(items)) def __len__(self): return self.__count diff --git a/tests/test_map.py b/tests/test_map.py index b6ee7f19..4a473b31 100644 --- a/tests/test_map.py +++ b/tests/test_map.py @@ -845,11 +845,10 @@ def test_map_getitem_1(self): def test_repr_1(self): h = self.Map() - self.assertTrue(repr(h).startswith('