Description
Pandas version checks
-
I have checked that this issue has not already been reported.
-
I have confirmed this bug exists on the latest version of pandas.
-
I have confirmed this bug exists on the main branch of pandas.
Reproducible Example
Use pandas version==1.4.2 python environment with current main version of the generate_legacy_storage_files (in https://github.com/pandas-dev/pandas/blob/main/pandas/tests/io/generate_legacy_storage_files.py) to generate pickle file.
python -m tests.io.generate_legacy_storage_files tests/io/data/legacy_pickle/1.4.2/ pickle
Using pandas version==1.5.0.dev0+794.g4f92db3b5d to load pickle file,
path = '/home/open_source/pandas_2/pandas/pandas/tests/io/data/legacy_pickle/1.4.2/1.4.2_x86_64_linux_3.9.7.pickle'
data = pd.read_pickle(path)
Issue Description
The error is raised when read pickle pandas version==1.4.2 with pandas version=1.5.0.dev0+794.g4f92db3b5d
Traceback (most recent call last):
File "/home/open_source/pandas_2/pandas/pandas/io/pickle.py", line 205, in read_pickle
return pickle.load(handles.handle)
File "pandas/_libs/tslibs/timestamps.pyx", line 151, in pandas._libs.tslibs.timestamps._unpickle_timestamp
TypeError: _unpickle_timestamp() takes exactly 4 positional arguments (3 given)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/open_source/pandas_2/pandas/pandas/compat/pickle_compat.py", line 39, in load_reduce
stack[-1] = func(*args)
File "pandas/_libs/tslibs/timestamps.pyx", line 151, in pandas._libs.tslibs.timestamps._unpickle_timestamp
TypeError: _unpickle_timestamp() takes exactly 4 positional arguments (3 given)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/open_source/pandas_2/development/development_5.py", line 36, in <module>
data = pd.read_pickle(path)
File "/home/open_source/pandas_2/pandas/pandas/io/pickle.py", line 210, in read_pickle
return pc.load(handles.handle, encoding=None)
File "/home/open_source/pandas_2/pandas/pandas/compat/pickle_compat.py", line 272, in load
return up.load()
File "/root/anaconda3/lib/python3.9/pickle.py", line 1212, in load
dispatch[key[0]](self)
File "/home/open_source/pandas_2/pandas/pandas/compat/pickle_compat.py", line 60, in load_reduce
elif args and issubclass(args[0], PeriodArray):
TypeError: issubclass() arg 1 must be a class
There is incompatibilities issues which this is picking up. (function needs to be made backwards compatible)
- (looks like need to set the default value of reso in _unpickle_timestamp to NPY_FR_ns)
Expected Behavior
Able to read pickle pandas version==1.4.2 with pandas version=1.5.0.dev0+794.g4f92db3b5d.
Installed Versions
python : 3.9.7.final.0
python-bits : 64
OS : Linux
OS-release : 5.10.16.3-microsoft-standard-WSL2
Version : #1 SMP Fri Apr 2 22:23:49 UTC 2021
machine : x86_64
processor : x86_64
byteorder : little
LC_ALL : None
LANG : C.UTF-8
LOCALE : en_US.UTF-8
pandas : 1.5.0.dev0+806.g7389a95737.dirty
numpy : 1.22.3
pytz : 2021.3
dateutil : 2.8.2
pip : 21.2.4
setuptools : 58.0.4
Cython : 0.29.24
pytest : 6.2.4
hypothesis : 6.42.0
sphinx : 4.2.0
blosc : None
feather : None
xlsxwriter : 3.0.1
lxml.etree : 4.6.3
html5lib : 1.1
pymysql : None
psycopg2 : None
jinja2 : 2.11.3
IPython : 7.29.0
pandas_datareader: None
bs4 : 4.10.0
bottleneck : 1.3.2
brotli :
fastparquet : None
fsspec : 2021.08.1
gcsfs : None
matplotlib : 3.4.3
numba : None
numexpr : 2.7.3
odfpy : None
openpyxl : 3.0.9
pandas_gbq : None
pyarrow : 7.0.0
pyreadstat : None
pyxlsb : None
s3fs : None
scipy : 1.7.1
snappy : None
sqlalchemy : 1.4.22
tables : 3.6.1
tabulate : None
xarray : None
xlrd : 2.0.1
xlwt : 1.3.0
zstandard : None