Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions stdlib/@tests/test_cases/check_configparser.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from configparser import RawConfigParser, SectionProxy
from typing_extensions import assert_type

sp = SectionProxy(RawConfigParser(), "")
assert_type(sp.get("foo", fallback="hi"), str)
11 changes: 9 additions & 2 deletions stdlib/configparser.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,14 @@ class SectionProxy(MutableMapping[str, str]):
# This is incompatible with MutableMapping so we ignore the type
@overload # type: ignore[override]
def get(
self, option: str, *, raw: bool = False, vars: _Section | None = None, _impl: Any | None = None, **kwargs: Any
self,
option: str,
fallback: None = None,
*,
raw: bool = False,
vars: _Section | None = None,
_impl: Any | None = None,
**kwargs: Any, # passed to the underlying parser's get() method
) -> str | None: ...
@overload
def get(
Expand All @@ -331,7 +338,7 @@ class SectionProxy(MutableMapping[str, str]):
raw: bool = False,
vars: _Section | None = None,
_impl: Any | None = None,
**kwargs: Any,
**kwargs: Any, # passed to the underlying parser's get() method
) -> str | _T: ...
# These are partially-applied version of the methods with the same names in
# RawConfigParser; the stubs should be kept updated together
Expand Down