Skip to content
This repository was archived by the owner on Mar 9, 2022. It is now read-only.

Update __reduce__ of exceptions to support pickling#49

Open
daikts wants to merge 1 commit intoverata-veritatis:masterfrom
daikts:pickle-patch
Open

Update __reduce__ of exceptions to support pickling#49
daikts wants to merge 1 commit intoverata-veritatis:masterfrom
daikts:pickle-patch

Conversation

@daikts
Copy link

@daikts daikts commented Sep 8, 2021

This fixes the inability to pickle the custom exception classes, e.g.

import pickle
import pybit

e = pybit.exceptions.InvalidRequestError("foo", "bar", "baz", "quux")
print(e)
pickled = pickle.dumps(e)
unpickled = pickle.loads(pickled)  # TypeError: __init__() missing 3 required positional arguments: 'message', 'status_code', and 'time'

print(e)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant