Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle properties in __setstate__ #4134

Merged
merged 6 commits into from Mar 3, 2024
Merged

Conversation

harshil21
Copy link
Member

Closes #4111.

Implementing tests for this was hard! Since our library's code will keep changing, we could not rely on the previous method of pickling a file from an older version and unpickling in our current version. We need to specfically test when we are in a deprecation phase like now. So I came up with using exec() statements to fool Python into thinking the class is changing.

Copy link
Member

@Bibo-Joshi Bibo-Joshi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks & kudos for the PR! The number of changed lines is not that big but I can imagine that it took quite some headache to get it done 😬
Just smaller comments

telegram/_telegramobject.py Outdated Show resolved Hide resolved
tests/test_telegramobject.py Show resolved Hide resolved
telegram/_telegramobject.py Show resolved Hide resolved
@Bibo-Joshi Bibo-Joshi merged commit bd9b0bd into master Mar 3, 2024
24 checks passed
@Bibo-Joshi Bibo-Joshi deleted the pickle-backward-compat branch March 3, 2024 18:22
@github-actions github-actions bot locked and limited conversation to collaborators Mar 11, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEATURE] Improve Backward Compatibility for pickling
2 participants