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 serhiy.storchaka
Recipients Arfrever, barry, benjamin.peterson, eric.snow, hodgestar, lukasz.langa, pitrou, python-dev, rhettinger, robagar, serhiy.storchaka
Date 2017-09-12.17:59:22
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
> The two test cases added demonstrate what was impossible to pickle before and is now.

These two classes obviously are not pickleable. Pickling or copying them is a programming error. I believe the proper way of making them pickleable and copyable is implementing corresponding special methods.

> Can you give me an example where this would lead to incorrect pickle data?

Any class that needs non-trivial __getstate__(). If pickling is failed now it means that the class is not pickleable. With your patch pickling can be successful, but there is no guarantee that it is correct.

For example, modifying one of your example:

class Proxy:
    def __init__(self, proxied_object):
        self.proxied_object = proxied_object = id(proxied_object)
    def __getattr__(self, name):
        return getattr(self.proxied_object, name)

> This is what `hasattr()` in Python 2 did.  This is why in Python 2 the `RecursionError` example I added to the tests was actually working just fine.

hasattr() is broken in Python 2. It was fixed in Python 3. Your patch reintroduces similar bug in copy.
Date User Action Args
2017-09-12 17:59:22serhiy.storchakasetrecipients: + serhiy.storchaka, barry, rhettinger, pitrou, benjamin.peterson, hodgestar, Arfrever, lukasz.langa, python-dev, eric.snow, robagar
2017-09-12 17:59:22serhiy.storchakasetmessageid: <>
2017-09-12 17:59:22serhiy.storchakalinkissue16251 messages
2017-09-12 17:59:22serhiy.storchakacreate