Skip to content

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

Open
JelleZijlstra wants to merge 1 commit intopython:mainfrom
JelleZijlstra:parse-unspec
Open

gh-149083: Use sentinel for urllib.parse._UNSPECIFIED#149612
JelleZijlstra wants to merge 1 commit intopython: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


_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.

@@ -0,0 +1,2 @@
The private ``_UNSPECIFIED`` sentinel in :mod:`urllib.parse` is now an
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.

A NEWS entry is not needed for private sentinel.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants