Repository navigation
gh-63293: Deprecate providing false values besides strings, bytes, or None to urllib.parse functions - #26687
gh-63293: Deprecate providing false values besides strings, bytes, or None to urllib.parse functions#26687jacobtylerwalls wants to merge 13 commits into
None to urllib.parse functions#26687Conversation
|
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 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. |
This comment was marked as resolved.
This comment was marked as resolved.
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. |
| .. versionchanged:: 3.15 | ||
| Added the *missing_as_none* parameter. | ||
|
|
||
| .. versionchanged:: 3.16 |
There was a problem hiding this comment.
This was the confusing part for me. I think, we can just split it as they are two different things already.
+.. versionchanged:: 3.16
+ Passing an object that is not a string, bytes, or ``None`` now raises
+ :exc:`TypeError` instead of :exc:`AttributeError`.
+
+.. deprecated:: 3.16
+ Accepting objects with false values (like ``0`` and ``[]``) except empty
+ strings, byte-like objects and ``None`` is now deprecated. They will raise
+ :exc:`TypeError` in Python 3.18.
|
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) |
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