-
Notifications
You must be signed in to change notification settings - Fork 6k
Closed
Labels
ℹ️ good-first-issueinformation: good-first-issueinformation: good-first-issue
Description
Steps to reproduce
Hi. I encountered a small issue with an user because it does not seem possible to pickle TelegramException exceptions and their descendants.
import pickle
from telegram.error import TelegramException
error = TelegramException("Foobar")
pickled = pickle.dumps(error) # OK
unpikcled = pickle.loads(pickled) # NOK
# TypeError: __init__() missing 1 required positional argument: 'message'This is actually not new, many Python users have encountered this kind of problem by implementing custom exceptions:
- Cannot unpickle Exception subclass
- How to pickle inherited exceptions?
- How to make a custom exception class with multiple init args pickleable
Expected behaviour
The exception should be deserialized without issue.
Actual behaviour
A TypeError is raised.
Configuration
Operating System: Arch Linux
Version of Python, python-telegram-bot & dependencies:
python-telegram-bot 12.8 (0.5.3-0-gf31e971)
certifi 2020.06.20
Python 3.8.5 (default, Sep 5 2020, 10:50:12) [GCC 10.2.0]
Logs
Not relevant.
Metadata
Metadata
Assignees
Labels
ℹ️ good-first-issueinformation: good-first-issueinformation: good-first-issue