Message281070
xref to https://github.com/pandas-dev/pandas/issues/14679.
pandas has had a cython extension class to datetime.datetime for quite some time. A simple __reduce__ is defined.
def __reduce__(self):
object_state = self.value, self.freq, self.tzinfo
print(object_state)
return (Timestamp, object_state)
In 3.5.2:
Python 3.5.2 |Continuum Analytics, Inc.| (default, Jul 2 2016, 17:52:12)
[GCC 4.2.1 Compatible Apple LLVM 4.2 (clang-425.0.28)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pandas as pd
>>> import pickle
>>> pickle.dumps(pd.Timestamp('20130101'))
(1356998400000000000, None, None)
b'\x80\x03cpandas.tslib\nTimestamp\nq\x00\x8a\x08\x00\x00\xc6\xe8\xda\x06\xd5\x12NN\x87q\x01Rq\x02.'
But in 3.6.03b
Python 3.6.0b3 | packaged by conda-forge | (default, Nov 2 2016, 03:28:12)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.54)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pandas as pd
>>> import pickle
>>> pickle.dumps(pd.Timestamp('20130101'))
b'\x80\x03cpandas.tslib\nTimestamp\nq\x00C\n\x07\xdd\x01\x01\x00\x00\x00\x00\x00\x00q\x01\x85q\x02Rq\x03.'
So it appears __reduce__ is no longer called at all (I tried defining __getstate__, __getnewargs__ as well, but to no avail). Instead it looks like datetime.datetime.__reduce__ (well a c function is actually called).
Link to the codebase. https://github.com/pandas-dev/pandas/blob/master/pandas/tslib.pyx#L490 |
|
Date |
User |
Action |
Args |
2016-11-18 01:31:03 | Jeff Reback | set | recipients:
+ Jeff Reback |
2016-11-18 01:31:03 | Jeff Reback | set | messageid: <1479432663.49.0.198725524634.issue28730@psf.upfronthosting.co.za> |
2016-11-18 01:31:03 | Jeff Reback | link | issue28730 messages |
2016-11-18 01:31:00 | Jeff Reback | create | |
|