Skip to content

Correct positional-only parameters in datetime.pyi #6343

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

Merged
merged 3 commits into from
Nov 19, 2021

Conversation

AlexWaygood
Copy link
Member

These are all positional-or-keyword parameters in the pure-Python implementation, but positional-only parameters in the C implementation. Thus, passing them as keyword arguments is unreliable, and will result in errors being raised in some situations.

These are all positional-or-keyword parameters in the pure-Python implementation, but positional-only parameters in the C implementation. Thus, passing them as keyword arguments is unreliable, and will result in errors being raised in some situations.
Copy link
Member

@JelleZijlstra JelleZijlstra left a comment

Choose a reason for hiding this comment

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

Thanks! It's probably worth submitting a PR to CPython to get the Python implementation synced.

@AlexWaygood
Copy link
Member Author

AlexWaygood commented Nov 19, 2021

Thanks! It's probably worth submitting a PR to CPython to get the Python implementation synced.

I created https://bugs.python.org/issue45821, but stopped short of filing a PR, as I wasn't sure if making all the parameters positional-only in the Python implementation would be backwards-compatible -- it might be better to make all the parameters in the C implementation positional-or-keyword? And, uh, I can't write C code (yet) 😢

@github-actions

This comment has been minimized.

@AlexWaygood
Copy link
Member Author

Oh, that diff is entirely due to the second argument of fromtimestamp, which doesn't need to be positional-only. I'll fix that.

@github-actions

This comment has been minimized.

@github-actions
Copy link
Contributor

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

@JelleZijlstra JelleZijlstra merged commit 916ca06 into python:master Nov 19, 2021
@AlexWaygood AlexWaygood deleted the patch-1 branch November 19, 2021 15:11
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.

3 participants