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 belopolsky, jaraco, serhiy.storchaka
Date 2016-11-20.16:10:56
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1479658256.59.0.821335963019.issue28752@psf.upfronthosting.co.za>
In-reply-to
Content
Now pickling of the datetime.datetime objects is implemented with __reduce_ex__. __reduce__ is not defined in datetime.datetime and is inherited from datetime.date.

>>> datetime.datetime.__reduce_ex__
<method '__reduce_ex__' of 'datetime.datetime' objects>
>>> datetime.datetime.__reduce__
<method '__reduce__' of 'datetime.date' objects>

__reduce_ex__ has higher priority and is called instead of __reduce__. It is weird that __reduce_ex__ and __reduce__ are not consistent. __reduce__ should be defined as

    def __reduce__(self):
        return self.__reduce_ex__(2)

or just

    __reduce__ = object.__reduce__

Other way is to define __reduce_ex__ instead of __reduce__ in datetime.date.
History
Date User Action Args
2016-11-20 16:10:56serhiy.storchakasetrecipients: + serhiy.storchaka, jaraco, belopolsky
2016-11-20 16:10:56serhiy.storchakasetmessageid: <1479658256.59.0.821335963019.issue28752@psf.upfronthosting.co.za>
2016-11-20 16:10:56serhiy.storchakalinkissue28752 messages
2016-11-20 16:10:56serhiy.storchakacreate