Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 61c0064

Browse filesBrowse files
committed
Add back workaround to avoid confusing mypy.types and types in pyinfo (#13176)
We run mypy/pyinfo.py as a script, and this means that mypy/types.py could be picked up instead of the stdlib `types` module, which clearly doesn't work. This seems to happen at least on macOS, and it broke PEP 561 tests. The workaround was accidentally removed as part of #13161. This should fix #13174 and help with the wheel builds.
1 parent d8d900c commit 61c0064
Copy full SHA for 61c0064

File tree

Expand file treeCollapse file tree

1 file changed

+9
-0
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+9
-0
lines changed

‎mypy/pyinfo.py

Copy file name to clipboardExpand all lines: mypy/pyinfo.py
+9Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,15 @@
1414
if MYPY:
1515
from typing import List
1616

17+
if __name__ == '__main__':
18+
# HACK: We don't want to pick up mypy.types as the top-level types
19+
# module. This could happen if this file is run as a script.
20+
# This workaround fixes it.
21+
old_sys_path = sys.path
22+
sys.path = sys.path[1:]
23+
import types # noqa
24+
sys.path = old_sys_path
25+
1726

1827
def getsearchdirs():
1928
# type: () -> List[str]

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.