From 8073467194113ab9f86334d9e181435f59d78bb5 Mon Sep 17 00:00:00 2001 From: Brian Schubert <brianm.schubert@gmail.com> Date: Thu, 31 Oct 2024 18:06:31 -0400 Subject: [PATCH 1/2] Return `| None` from SectionProxy.get* when fallback is not specified --- stdlib/configparser.pyi | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/stdlib/configparser.pyi b/stdlib/configparser.pyi index ee5000196e0e..19bc5e1f97de 100644 --- a/stdlib/configparser.pyi +++ b/stdlib/configparser.pyi @@ -309,19 +309,19 @@ class SectionProxy(MutableMapping[str, str]): vars: _Section | None = None, _impl: Any | None = None, **kwargs: Any, - ) -> str | Any: ... # can be None in RawConfigParser's sections + ) -> str | None: ... # can be None in RawConfigParser's sections # These are partially-applied version of the methods with the same names in # RawConfigParser; the stubs should be kept updated together @overload - def getint(self, option: str, *, raw: bool = ..., vars: _Section | None = ...) -> int: ... + def getint(self, option: str, *, raw: bool = ..., vars: _Section | None = ...) -> int | None: ... @overload def getint(self, option: str, fallback: _T = ..., *, raw: bool = ..., vars: _Section | None = ...) -> int | _T: ... @overload - def getfloat(self, option: str, *, raw: bool = ..., vars: _Section | None = ...) -> float: ... + def getfloat(self, option: str, *, raw: bool = ..., vars: _Section | None = ...) -> float | None: ... @overload def getfloat(self, option: str, fallback: _T = ..., *, raw: bool = ..., vars: _Section | None = ...) -> float | _T: ... @overload - def getboolean(self, option: str, *, raw: bool = ..., vars: _Section | None = ...) -> bool: ... + def getboolean(self, option: str, *, raw: bool = ..., vars: _Section | None = ...) -> bool | None: ... @overload def getboolean(self, option: str, fallback: _T = ..., *, raw: bool = ..., vars: _Section | None = ...) -> bool | _T: ... # SectionProxy can have arbitrary attributes when custom converters are used From a891da94c519fe09a7a0066fac00604e7f917ff2 Mon Sep 17 00:00:00 2001 From: Brian Schubert <brianm.schubert@gmail.com> Date: Mon, 25 Nov 2024 11:41:05 -0500 Subject: [PATCH 2/2] Return `| None` from SectionProxy.get when fallback is not specified --- stdlib/configparser.pyi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stdlib/configparser.pyi b/stdlib/configparser.pyi index b87bc69c5239..a665631d1408 100644 --- a/stdlib/configparser.pyi +++ b/stdlib/configparser.pyi @@ -304,7 +304,7 @@ class SectionProxy(MutableMapping[str, str]): @overload # type: ignore[override] def get( self, option: str, *, raw: bool = False, vars: _Section | None = None, _impl: Any | None = None, **kwargs: Any - ) -> str | MaybeNone: ... # can be None in RawConfigParser's sections + ) -> str | None: ... @overload def get( self,