From f6e8edc3da54b627e378e40fd1914dbba0acc65c Mon Sep 17 00:00:00 2001 From: Alex Waygood Date: Tue, 28 Jun 2022 18:47:11 +0100 Subject: [PATCH 1/2] Improve `urllib.parse.urldefrag` Fixes #2477 --- stdlib/urllib/parse.pyi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stdlib/urllib/parse.pyi b/stdlib/urllib/parse.pyi index 49f3825e0821..43f101f51a6b 100644 --- a/stdlib/urllib/parse.pyi +++ b/stdlib/urllib/parse.pyi @@ -66,7 +66,7 @@ class _NetlocResultMixinBase(Generic[AnyStr]): class _NetlocResultMixinStr(_NetlocResultMixinBase[str], _ResultMixinStr): ... class _NetlocResultMixinBytes(_NetlocResultMixinBase[bytes], _ResultMixinBytes): ... -class _DefragResultBase(tuple[Any, ...], Generic[AnyStr]): +class _DefragResultBase(tuple[AnyStr, ...], Generic[AnyStr]): if sys.version_info >= (3, 10): __match_args__ = ("url", "fragment") @property From b39920da8d02247f502d8c936f142d93baabb5e3 Mon Sep 17 00:00:00 2001 From: Alex Waygood Date: Tue, 19 Jul 2022 09:31:24 +0100 Subject: [PATCH 2/2] Add explanatory comment --- stdlib/urllib/parse.pyi | 2 ++ 1 file changed, 2 insertions(+) diff --git a/stdlib/urllib/parse.pyi b/stdlib/urllib/parse.pyi index 43f101f51a6b..7e1ec903a15e 100644 --- a/stdlib/urllib/parse.pyi +++ b/stdlib/urllib/parse.pyi @@ -66,6 +66,8 @@ class _NetlocResultMixinBase(Generic[AnyStr]): class _NetlocResultMixinStr(_NetlocResultMixinBase[str], _ResultMixinStr): ... class _NetlocResultMixinBytes(_NetlocResultMixinBase[bytes], _ResultMixinBytes): ... +# Ideally this would be a generic fixed-length tuple, +# but mypy doesn't support that yet: https://github.com/python/mypy/issues/685#issuecomment-992014179 class _DefragResultBase(tuple[AnyStr, ...], Generic[AnyStr]): if sys.version_info >= (3, 10): __match_args__ = ("url", "fragment")