Skip to content

Commit 8bd3e16

Browse files
authored
Add back module-level __getattr__ to encodings (#5261)
This is needed for submodules, such as `encodings.cp437`.
1 parent 2c8cb60 commit 8bd3e16

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

pyrightconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
],
77
"exclude": [
88
"**/@python2",
9+
"stdlib/encodings",
910
"stdlib/sqlite3/dbapi2.pyi",
1011
"stdlib/tkinter",
1112
"stdlib/xml/dom",
@@ -83,4 +84,4 @@
8384
// Mypy's overlapping overload logic misses these issues (see mypy
8485
// issue #10143 and #10157).
8586
"reportOverlappingOverload": "none"
86-
}
87+
}

stdlib/encodings/__init__.pyi

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
from codecs import CodecInfo
2-
from typing import Optional, Union
2+
from typing import Any, Optional, Union
33

44
class CodecRegistryError(LookupError, SystemError): ...
55

66
def normalize_encoding(encoding: Union[str, bytes]) -> str: ...
77
def search_function(encoding: str) -> Optional[CodecInfo]: ...
8+
9+
# Needed for submodules
10+
def __getattr__(name: str) -> Any: ... # incomplete

0 commit comments

Comments
 (0)