Repository navigation
gh-63293: Deprecate providing false values besides strings, bytes, or None to urllib.parse functions - #26687
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. |
f156d42 to
d2f1bb9
Compare
|
From the failing docs job, I see |
|
@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. |
Documentation build overview
477 files changed ·
|
None to urllib.parse functions
|
This PR is stale because it has been open for 90 days with no activity. |
|
This just came to my attention due to github-actions bot stale label applying. I don't know why we are doing this TBH. I will review this and take an action. I don't want to keep this pending. |
|
I will make some minor changes to this PR and we can proceed with it. My main focus will be to present it as clear and simple as possible, and reuse the messaging from (#116903) |
False values upfront as it is more explicit. Split the version changed into two parts. Change AttributeError to TypeError and DeprecationWarning for false values. The message will remain similar to 3.14 message.
|
Thank you @jacobtylerwalls for this contribution and follow-up. |
|
Of course, thanks for the review! |
bpo-19094 and bpo-22234
Like a recent change in
parse_qsl()(#116903) to require strings, bytes, orNone, require this in otherurllib.parsefunctions as well, with a deprecation cycle for false values.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_cachedecorator requiring hashable types. This is the chief reason for rotating unsupported types in the test cases.https://bugs.python.org/issue19094
Closes #63293
Closes #66430