From ca6ff3cdc61f33b1d46e4456c0354d5319a649ed Mon Sep 17 00:00:00 2001 From: guoci Date: Tue, 28 Oct 2025 14:58:31 -0400 Subject: [PATCH 1/3] In `sysconfig` module, add `_get_preferred_schemes` --- stdlib/sysconfig.pyi | 1 + 1 file changed, 1 insertion(+) diff --git a/stdlib/sysconfig.pyi b/stdlib/sysconfig.pyi index 807a979050e8..d5965dceca91 100644 --- a/stdlib/sysconfig.pyi +++ b/stdlib/sysconfig.pyi @@ -30,6 +30,7 @@ def get_scheme_names() -> tuple[str, ...]: ... if sys.version_info >= (3, 10): def get_default_scheme() -> str: ... def get_preferred_scheme(key: Literal["prefix", "home", "user"]) -> str: ... + def _get_preferred_schemes() -> dict[Literal["prefix", "home", "user"], str]: ... def get_path_names() -> tuple[str, ...]: ... def get_path(name: str, scheme: str = ..., vars: dict[str, Any] | None = None, expand: bool = True) -> str: ... From 8564a16b04febe47fffd25fa87387fbf661e45f9 Mon Sep 17 00:00:00 2001 From: Guo Ci Date: Wed, 29 Oct 2025 10:14:08 -0400 Subject: [PATCH 2/3] Add comments for underscore-prefixed symbols Co-authored-by: Alex Waygood --- stdlib/sysconfig.pyi | 1 + 1 file changed, 1 insertion(+) diff --git a/stdlib/sysconfig.pyi b/stdlib/sysconfig.pyi index d5965dceca91..838780806a42 100644 --- a/stdlib/sysconfig.pyi +++ b/stdlib/sysconfig.pyi @@ -30,6 +30,7 @@ def get_scheme_names() -> tuple[str, ...]: ... if sys.version_info >= (3, 10): def get_default_scheme() -> str: ... def get_preferred_scheme(key: Literal["prefix", "home", "user"]) -> str: ... + # Documented -- see https://docs.python.org/3/library/sysconfig.html#sysconfig._get_preferred_schemes def _get_preferred_schemes() -> dict[Literal["prefix", "home", "user"], str]: ... def get_path_names() -> tuple[str, ...]: ... From d006f459f92f1b8be170fa273c868db224e444b1 Mon Sep 17 00:00:00 2001 From: Alex Waygood Date: Wed, 29 Oct 2025 10:21:18 -0400 Subject: [PATCH 3/3] use `LiteralString` for some APIs --- stdlib/sysconfig.pyi | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/stdlib/sysconfig.pyi b/stdlib/sysconfig.pyi index 838780806a42..c6419222df97 100644 --- a/stdlib/sysconfig.pyi +++ b/stdlib/sysconfig.pyi @@ -1,6 +1,6 @@ import sys from typing import IO, Any, Literal, overload -from typing_extensions import deprecated +from typing_extensions import LiteralString, deprecated __all__ = [ "get_config_h_filename", @@ -28,10 +28,10 @@ def get_config_vars(arg: str, /, *args: str) -> list[Any]: ... def get_scheme_names() -> tuple[str, ...]: ... if sys.version_info >= (3, 10): - def get_default_scheme() -> str: ... - def get_preferred_scheme(key: Literal["prefix", "home", "user"]) -> str: ... + def get_default_scheme() -> LiteralString: ... + def get_preferred_scheme(key: Literal["prefix", "home", "user"]) -> LiteralString: ... # Documented -- see https://docs.python.org/3/library/sysconfig.html#sysconfig._get_preferred_schemes - def _get_preferred_schemes() -> dict[Literal["prefix", "home", "user"], str]: ... + def _get_preferred_schemes() -> dict[Literal["prefix", "home", "user"], LiteralString]: ... def get_path_names() -> tuple[str, ...]: ... def get_path(name: str, scheme: str = ..., vars: dict[str, Any] | None = None, expand: bool = True) -> str: ...