Skip to content

gh-149083: Use sentinel for urllib.parse._UNSPECIFIED#149612

Open
JelleZijlstra wants to merge 3 commits into
python:mainfrom
JelleZijlstra:parse-unspec
Open

gh-149083: Use sentinel for urllib.parse._UNSPECIFIED#149612
JelleZijlstra wants to merge 3 commits into
python:mainfrom
JelleZijlstra:parse-unspec

Conversation

@JelleZijlstra
Copy link
Copy Markdown
Member

@JelleZijlstra JelleZijlstra commented May 9, 2026

This was added in 3.15; let's use a real sentinel instead of an ad-hoc list object.

Since it's new in 3.15, I think it's fine to apply the change to both 3.15 and main (cc @hugovk). I added a NEWS entry out of an abundance of caution.

This was added in 3.15; let's use a real sentinel instead of an ad-hoc list object.
@JelleZijlstra JelleZijlstra added the needs backport to 3.15 pre-release feature fixes, bugs and security fixes label May 9, 2026
Comment thread Lib/urllib/parse.py Outdated


_UNSPECIFIED = ['not specified']
_UNSPECIFIED = sentinel("_UNSPECIFIED")
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Would not it look better in the help if use "<not specified>" as a name? This sentinel is not intended to be pickled or used by user. It is just a placeholder for the case when the user has not specified the argument.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I used the repr= argument now that we have it.

Comment thread Misc/NEWS.d/next/Library/2026-05-09-10-50-00.gh-issue-149083.56s2W-.rst Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting core review needs backport to 3.15 pre-release feature fixes, bugs and security fixes skip news

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants