This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author siming85
Recipients siming85
Date 2018-04-30.20:39:51
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1525120791.11.0.682650639539.issue33395@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2018-04-30 20:39:51siming85setrecipients: + siming85
2018-04-30 20:39:51siming85setmessageid: <1525120791.11.0.682650639539.issue33395@psf.upfronthosting.co.za>
2018-04-30 20:39:51siming85linkissue33395 messages
2018-04-30 20:39:51siming85create