Skip to content

Add missing __reduce__ and __reduce_ex__ methods to datetime classes #6321

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

Closed

Conversation

AlexWaygood
Copy link
Member

No description provided.

@github-actions

This comment has been minimized.

1 similar comment
@github-actions
Copy link
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

@JelleZijlstra
Copy link
Member

This has a merge conflict now.

I'm not terribly enthusiastic about adding __reduce__ methods, and especially their precise return types, because those are implementation details that people generally shouldn't rely on. Did you have a specific use case for this PR? We do have a few dozen __reduce__ method definitions in typeshed already.

@AlexWaygood
Copy link
Member Author

I'm not terribly enthusiastic about adding __reduce__ methods, and especially their precise return types, because those are implementation details that people generally shouldn't rely on. Did you have a specific use case for this PR? We do have a few dozen __reduce__ method definitions in typeshed already.

No specific use case — happy to close it if you think it's more trouble than it's worth. Was simply comparing the stub with the output from help(), and noticed the missing methods. I'll confess I don't really know much about these methods.

Your point about the precise return type being an implementation detail is a good one — happy to make the return types more vague. I think including the methods in some form might be useful to a user of the stubs, however, given that quite a few objects aren't pickleable. The user would see these methods (with a non-NoReturn return type), and know that these objects are pickleable. But on the other hand, maybe the user should just go to the documentation to find out that piece of information.

Anyway, happy to either revise this or close this.

@AlexWaygood AlexWaygood deleted the datetime-pickle-methods branch November 19, 2021 19:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants