Skip to content

urllib.parse: Fix issues with TypeVar usage and default values #9629

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 17 commits into from
Jan 31, 2023

Conversation

AlexWaygood
Copy link
Member

@AlexWaygood AlexWaygood commented Jan 30, 2023

The TypeVar usage in urlencode is invalid: the _Q TypeVar will go unsolved if no value is passed in for the safe parameter. To fix this, it must become an overloaded function.

For urlparse and urlsplit, the = ...s are unnecessary and incorrect for the second overload; the first overload takes care of the cases where a user doesn't specify a value for the scheme parameter. However, it seems like there are a lot of cases of people passing in str | None for the first parameter in the wild, which makes simply removing the = ...s here quite disruptive. Add a third overload to make the change less disruptive.

Refs #9608

@github-actions

This comment has been minimized.

@AlexWaygood AlexWaygood marked this pull request as draft January 30, 2023 23:38
@github-actions

This comment has been minimized.

@AlexWaygood AlexWaygood marked this pull request as ready for review January 30, 2023 23:59
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
@github-actions

This comment has been minimized.

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
@AlexWaygood AlexWaygood marked this pull request as draft January 31, 2023 01:55
@github-actions

This comment has been minimized.

@AlexWaygood AlexWaygood marked this pull request as ready for review January 31, 2023 02:06
@github-actions
Copy link
Contributor

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

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