bpo-16251: pickle special methods and custom getattr by ambv · Pull Request #3508 · python/cpython (original) (raw)

This PR doesn't change the lookup to types as the issue's title on BPO
suggests. As Antoine and Raymond point out, there'd be significant danger of
breaking existing code.

Instead, we're doing the following:

This fixes two common failure scenarios covered at length in bpo-16251, its
duplicates, as well as on StackOverflow, etc. Worth fixing IMHO.

Funnily enough, the recursion limit exceeded scenario happened to work on
Python 2 since hasattr() there swallowed the RecursionError.

https://bugs.python.org/issue16251