-
-
Notifications
You must be signed in to change notification settings - Fork 26.9k
0.20rc1: test_old_pickle - KeyError #12016
Copy link
Copy link
Closed
Labels
Milestone
Description
_______________________________ test_old_pickle ________________________________
tmpdir = local('/tmp/pytest-of-pbuilder/pytest-0/test_old_pickle0')
def test_old_pickle(tmpdir):
# Check that a pickle that references sklearn.external.joblib can load
f = tmpdir.join('foo.pkl')
f.write(b'\x80\x02csklearn.externals.joblib.numpy_pickle\nNumpyArrayWrappe'
b'r\nq\x00)\x81q\x01}q\x02(U\x05dtypeq\x03cnumpy\ndtype\nq\x04U'
b'\x02i8q\x05K\x00K\x01\x87q\x06Rq\x07(K\x03U\x01<q\x08NNNJ\xff'
b'\xff\xff\xffJ\xff\xff\xff\xffK\x00tq\tbU\x05shapeq\nK\x01\x85q'
b'\x0bU\x05orderq\x0cU\x01Cq\rU\x08subclassq\x0ecnumpy\nndarray\nq'
b'\x0fU\nallow_mmapq\x10\x88ub\x01\x00\x00\x00\x00\x00\x00\x00.',
mode='wb')
> joblib_vendored.load(str(f))
../debian/tmp/usr/lib/python2.7/dist-packages/sklearn/tests/test_site_joblib.py:22:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python2.7/dist-packages/joblib/numpy_pickle.py:598: in load
obj = _unpickle(fobj, filename, mmap_mode)
/usr/lib/python2.7/dist-packages/joblib/numpy_pickle.py:526: in _unpickle
obj = unpickler.load()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <joblib.numpy_pickle.NumpyUnpickler instance at 0x7fddcc8c0a70>
def load(self):
"""Read a pickled object representation from the open file.
Return the reconstituted object hierarchy specified in the file.
"""
self.mark = object() # any new unique object
self.stack = []
self.append = self.stack.append
read = self.read
dispatch = self.dispatch
try:
while 1:
key = read(1)
> dispatch[key](self)
E KeyError: '\x01'
/usr/lib/python2.7/pickle.py:864: KeyError
full buildlog: http://neuro.debian.net/_files/_buildlogs/scikit-learn/0.20~rc1/scikit-learn_0.20~rc1-1_amd64.build
>>> import platform; print(platform.platform())
Linux-4.16.0-0.bpo.2-amd64-x86_64-with-debian-buster-sid
>>> import sys; print("Python", sys.version)
('Python', '2.7.15+ (default, Aug 31 2018, 11:56:52) \n[GCC 8.2.0]')
>>> import numpy; print("NumPy", numpy.__version__)
('NumPy', '1.14.5')
>>> import scipy; print("SciPy", scipy.__version__)
('SciPy', '1.1.0')
not sure if helps but here is the keys it has at that point:
while 1:
key = read(1)
> dispatch[key](self)
E KeyError: '\x01'
/usr/lib/python2.7/pickle.py:864: KeyError
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> entering PDB >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
> /usr/lib/python2.7/pickle.py(864)load()
-> dispatch[key](self)
(Pdb) p dispatch.keys()
['', '\x80', '\x83', '\x82', '\x85', '\x84', '\x87', '\x86', '\x89', '\x88', '\x8b', '\x8a', '\x81', ')', '(', '.', '1', '0', '2', 'G', 'F', 'I', 'K', 'J', 'M', 'L', 'N', 'Q', 'P', 'S', 'R', 'U', 'T', 'V', 'X', ']', 'a', 'c', 'b', 'e', 'd', 'g', 'i', 'h', 'j', 'l', 'o', 'q', 'p', 's', 'r', 'u', 't', '}']
Reactions are currently unavailable