Skip to content

Commit 853a4c1

Browse files
pkchilevkivskyi
authored andcommitted
Revert reveal_type message fix (#3267)
* Revert PR #3205 and #3235 * Stop redirecting to _importlib_modulespec
1 parent 665a810 commit 853a4c1

File tree

2 files changed

+0
-21
lines changed

2 files changed

+0
-21
lines changed

mypy/fixup.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515
)
1616
from mypy.visitor import NodeVisitor
1717

18-
from mypy.semanal import rev_module_rename_map
19-
2018

2119
def fixup_module_pass_one(tree: MypyFile, modules: Dict[str, MypyFile],
2220
quick_and_dirty: bool) -> None:
@@ -243,9 +241,6 @@ def lookup_qualified(modules: Dict[str, MypyFile], name: str,
243241

244242
def lookup_qualified_stnode(modules: Dict[str, MypyFile], name: str,
245243
quick_and_dirty: bool) -> Optional[SymbolTableNode]:
246-
if '_importlib_modulespec' in modules:
247-
# we are using python 3, so renaming is necessary
248-
name = rev_module_rename_map.get(name, name)
249244
head = name
250245
rest = []
251246
while True:

mypy/semanal.py

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -117,20 +117,6 @@
117117
'typing.typevar': 'typing.TypeVar',
118118
}
119119

120-
# Used for python 3 only
121-
# Rename objects placed in _importlib_modulespec due to circular imports
122-
# Safe in python 2 because no one will ask for these keys
123-
module_rename_map = {
124-
'_importlib_modulespec.ModuleType': 'types.ModuleType',
125-
'_importlib_modulespec.ModuleSpec': 'importlib.machinery.ModuleSpec',
126-
'_importlib_modulespec.Loader': 'importlib.abc.Loader'
127-
}
128-
129-
# Must not be used in python 2 (it will replace correct names with incorrect)
130-
# The check for version is currently made at the point of use
131-
# TODO: consider moving these maps from global scope to somewhere where python version is known
132-
rev_module_rename_map = {v: k for (k, v) in module_rename_map.items()}
133-
134120
# Hard coded type promotions (shared between all Python versions).
135121
# These add extra ad-hoc edges to the subtyping relation. For example,
136122
# int is considered a subtype of float, even though there is no
@@ -3339,8 +3325,6 @@ def visit_file(self, file: MypyFile, fnam: str, mod_id: str, options: Options) -
33393325

33403326
for d in defs:
33413327
d.accept(self)
3342-
if isinstance(d, ClassDef):
3343-
d.info._fullname = module_rename_map.get(d.info._fullname, d.info._fullname)
33443328

33453329
# Add implicit definition of literals/keywords to builtins, as we
33463330
# cannot define a variable with them explicitly.

0 commit comments

Comments
 (0)