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 scoder
Recipients Arfrever, alexandre.vassalotti, barry, josh.r, kitterma, nadeem.vawda, pitrou, python-dev, scoder, serhiy.storchaka
Date 2016-01-16.12:44:45
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1452948285.86.0.0341368085875.issue22995@psf.upfronthosting.co.za>
In-reply-to
Content
In fact, I did consider it and I'd love to, but it's not something to do lightly because the semantics would be a bit fuzzy and unsafe. Basically, extension types that have only Python object compatible attributes could automatically pickle, but as soon as you add, say, a C pointer attribute, it would fail to pickle at runtime, maybe even without an error (as in the case at hand). And what do you think, how many users write unit tests for pickling all of their extension types?

Imagine the case that Cython adds automatic pickling support for a base class and a user tries to implement pickling in a subclass, but using a different set of pickle support methods. It might then happen that the user implementation is silently ignored by the pickle implementation because it prefers the methods in the base class. The user might not even notice this because it (mostly) seems to work. And now think of the case where this user code exists already and Cython starts to enable the base class pickle support with a new release and overrides the user implementation. That might lead to seriously difficult to find bugs.

It would be great to make this support the default rather than requiring user interaction (say, a class decorator or compiler directive), but the subtle code breakage cases above sadly suggest otherwise...

Anyway, this needs more thinking and this ticket isn't the right place to do that.
History
Date User Action Args
2016-01-16 12:44:45scodersetrecipients: + scoder, barry, pitrou, alexandre.vassalotti, nadeem.vawda, Arfrever, kitterma, python-dev, serhiy.storchaka, josh.r
2016-01-16 12:44:45scodersetmessageid: <1452948285.86.0.0341368085875.issue22995@psf.upfronthosting.co.za>
2016-01-16 12:44:45scoderlinkissue22995 messages
2016-01-16 12:44:45scodercreate