-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
gh-63293: Deprecate providing false values besides strings or bytes to urllib.parse functions #26687
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
base: main
Are you sure you want to change the base?
Conversation
I just did a bpo search for duplicates and found bpo-22234. The discussion eventually came round to a similar solution after discussing the necessity of a deprecation period (believe the consensus = not needed). But in looking at the discussion there I realized it's safe to extend this solution to the other functions in the module and just factor this TypeError out to |
The failing test is caused by https://github.com/pypa/pip/blob/main/src/pip/_internal/models/link.py#L150-L154 I'll raise a PR against pip. So this may need to wait, unless we add a friendly shim. Notice that the other patch in bpo-22234 explicitly regarded this as an error condition:
Update: |
This comment was marked as outdated.
This comment was marked as outdated.
This PR is stale because it has been open for 30 days with no activity. |
…t()` for inappropriate types Co-authored-by: Vajrasky Kok <sky.kok@speaklikeaking.com>
This extends the solution to urldefrag(), urlunparse(), urlunsplit(), and parse_qsl()
f156d42
to
d2f1bb9
Compare
From the failing docs job, I see |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks ok.
@orsenthil I'm wondering if you have a view as a maintainer of Previously, values other than strings or bytes either failed cryptically with Is this a useful cleanup? I included a deprecation path for the falsy values. |
bpo-19094 and bpo-22234
Previously, although truthy values failed with
AttributeError: ... has no attribute 'decode'
, falsy values such as[]
were silently accepted.Original patch by @vajrasky.
I noticed in 3.11 (d597fdc) some inappropriate types will fail first in
urlsplit()
(only) via the@functools.lru_cache
decorator requiring hashable types. This is the chief reason for rotating unsupported types in the test cases.https://bugs.python.org/issue19094
Closes #63293