From b6842499ddc59806f924bf8e6c2407aca7e8ca71 Mon Sep 17 00:00:00 2001 From: Jelle Zijlstra Date: Sat, 9 May 2026 10:48:54 -0700 Subject: [PATCH] gh-149083: Use sentinel for urllib.parse._UNSPECIFIED This was added in 3.15; let's use a real sentinel instead of an ad-hoc list object. --- Lib/urllib/parse.py | 2 +- .../next/Library/2026-05-09-10-50-00.gh-issue-149083.56s2W-.rst | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 Misc/NEWS.d/next/Library/2026-05-09-10-50-00.gh-issue-149083.56s2W-.rst diff --git a/Lib/urllib/parse.py b/Lib/urllib/parse.py index d64f678d235b6f..2760772390baaa 100644 --- a/Lib/urllib/parse.py +++ b/Lib/urllib/parse.py @@ -277,7 +277,7 @@ def _hostinfo(self): return hostname, port -_UNSPECIFIED = ['not specified'] +_UNSPECIFIED = sentinel("_UNSPECIFIED") _MISSING_AS_NONE_DEFAULT = False class _ResultBase: diff --git a/Misc/NEWS.d/next/Library/2026-05-09-10-50-00.gh-issue-149083.56s2W-.rst b/Misc/NEWS.d/next/Library/2026-05-09-10-50-00.gh-issue-149083.56s2W-.rst new file mode 100644 index 00000000000000..d9c2fa85b5d8a7 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2026-05-09-10-50-00.gh-issue-149083.56s2W-.rst @@ -0,0 +1,2 @@ +The private ``_UNSPECIFIED`` sentinel in :mod:`urllib.parse` is now an +instance of :class:`sentinel`.