New submission from Siming Yuan <simin...@gmail.com>: in Python 3.5 it the pprint.PrettyPrinter mechanism got an overhaul, relying on PrettyPrinter._dispatch dict-lookup based on obj.__repr__ type.
This breaks any Cythonized 3rd party libraries that used to be pretty-printable in Python3.4. type(object).__repr__ <instancemethod __repr__ at 0x10cf2a618> since instancemethod_hash function has been commented out: https://github.com/python/cpython/blob/c30098c8c6014f3340a369a31df9c74bdbacc269/Objects/classobject.c#L569 oddly the behavior is different between Linux and Mac. The same object in Linux returns cyfunction, and is hashable, where as under the same CPython version in Mac, it returns instancemethod, rendering it unhashable. (based on Cython 0.27.3) note that this isn't exactly something related directly to the implementation of Cython. the old logic in Python <3.4 pprint was not pretty (pun not intended), but relied solely on type checking, where as the new implementation depends on hashing, which introduces this bug. ---------- messages: 315964 nosy: siming85 priority: normal severity: normal status: open title: TypeError: unhashable type: 'instancemethod' type: crash versions: Python 3.5, Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue33395> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com