Skip to content

Commit 4578526

Browse files
authored
[configparser] Fix return type of RawConfigParser.read (#15551)
1 parent 96f56d0 commit 4578526

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

stdlib/configparser.pyi

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import sys
2-
from _typeshed import MaybeNone, StrOrBytesPath, SupportsWrite
2+
from _typeshed import BytesPath, GenericPath, MaybeNone, StrOrBytesPath, StrPath, SupportsWrite
33
from collections.abc import Callable, ItemsView, Iterable, Iterator, Mapping, MutableMapping, Sequence
44
from re import Pattern
5-
from typing import Any, ClassVar, Final, Literal, TypeVar, overload, type_check_only
5+
from typing import Any, AnyStr, ClassVar, Final, Literal, TypeVar, overload, type_check_only
66
from typing_extensions import TypeAlias, deprecated
77

88
if sys.version_info >= (3, 14):
@@ -269,7 +269,14 @@ class RawConfigParser(_Parser):
269269
def has_section(self, section: _SectionName) -> bool: ...
270270
def options(self, section: _SectionName) -> list[str]: ...
271271
def has_option(self, section: _SectionName, option: str) -> bool: ...
272-
def read(self, filenames: StrOrBytesPath | Iterable[StrOrBytesPath], encoding: str | None = None) -> list[str]: ...
272+
@overload
273+
def read(self, filenames: GenericPath[AnyStr], encoding: str | None = None) -> list[AnyStr]: ...
274+
@overload
275+
def read(self, filenames: Iterable[StrPath], encoding: str | None = None) -> list[str]: ...
276+
@overload
277+
def read(self, filenames: Iterable[BytesPath], encoding: str | None = None) -> list[bytes]: ...
278+
@overload
279+
def read(self, filenames: Iterable[StrOrBytesPath], encoding: str | None = None) -> list[str | bytes]: ...
273280
def read_file(self, f: Iterable[str], source: str | None = None) -> None: ...
274281
def read_string(self, string: str, source: str = "<string>") -> None: ...
275282
def read_dict(self, dictionary: Mapping[str, Mapping[str, Any]], source: str = "<dict>") -> None: ...

0 commit comments

Comments
 (0)