Python pickle is broken?

Viewed 91

I receive strange error when I try to pickle and unpikle object of custom class

from collections import deque
class Buffer(deque):
    def __init__(self, maxlen=cf.BUFFER_SIZE):
        super().__init__(maxlen=maxlen)

class contains some additional functionality, but even such simple implementation produce error

code to reproduce error:

pickle.loads(pickle.dumps(Buffer()))

error:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-60-70ac6b3f6f8f> in <module>
----> 1 pickle.loads(pickle.dumps(Buffer(), fix_imports=False))

TypeError: __init__() takes from 1 to 2 positional arguments but 3 were given

Python version: 3.7.5 (default, Oct 25 2019, 15:51:11) [GCC 7.3.0]

0 Answers
Related