[issue33395] TypeError: unhashable type: 'instancemethod'

Siming Yuan report at bugs.python.org
Mon Apr 30 23:17:25 EDT 2018


Siming Yuan <siming85 at gmail.com> added the comment:

having a tough time trying to reproduce this issue in pure python.

any clue as to how to create a __repr__ that's unhashable?

class UnhashableRepr(dict):
    __repr__ = _testcapi.instancemethod(dict.__repr__)

doesn't work because that turns into a <slot wrapper '__repr__' of 'dict' objects> which becomes hashable.

i'd love to provide a patch, seems trivial to fix, but wouldn't want to do so without some tests.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue33395>
_______________________________________


More information about the Python-bugs-list mailing list