Skip to content

Conversation

@AlexWaygood
Copy link
Member

@AlexWaygood AlexWaygood commented Apr 18, 2022

I appear to have accidentally broken mypy.

When running mypy 0.942 against typeshed master, there are no problems.

But I have just (accidentally) discovered that if you run mypy master with --custom-typeshed-dir set to typeshed master, you get this:

C:\Users\alexw\coding\typeshed\stdlib\abc.pyi: error: INTERNAL ERROR -- Please try using mypy master on Github:
https://mypy.readthedocs.io/en/stable/common_issues.html#using-a-development-mypy-build
Please report a bug at https://github.com/python/mypy/issues
version: 0.960+dev.9cab2964a186d7e71567a1528fcc956f9eecebac
Traceback (most recent call last):
  File "C:\Users\alexw\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Users\alexw\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "C:\Users\alexw\coding\mypy\mypy\__main__.py", line 34, in <module>
    console_entry()
  File "C:\Users\alexw\coding\mypy\mypy\__main__.py", line 12, in console_entry
    main(None, sys.stdout, sys.stderr)
  File "C:\Users\alexw\coding\mypy\mypy\main.py", line 96, in main
    res, messages, blockers = run_build(sources, options, fscache, t0, stdout, stderr)
  File "C:\Users\alexw\coding\mypy\mypy\main.py", line 173, in run_build
    res = build.build(sources, options, None, flush_errors, fscache, stdout, stderr)
  File "C:\Users\alexw\coding\mypy\mypy\build.py", line 180, in build
    result = _build(
  File "C:\Users\alexw\coding\mypy\mypy\build.py", line 256, in _build
    graph = dispatch(sources, manager, stdout)
  File "C:\Users\alexw\coding\mypy\mypy\build.py", line 2733, in dispatch
    process_graph(graph, manager)
  File "C:\Users\alexw\coding\mypy\mypy\build.py", line 3081, in process_graph
    process_stale_scc(graph, scc, manager)
  File "C:\Users\alexw\coding\mypy\mypy\build.py", line 3173, in process_stale_scc
    mypy.semanal_main.semantic_analysis_for_scc(graph, scc, manager.errors)
  File "C:\Users\alexw\coding\mypy\mypy\semanal_main.py", line 78, in semantic_analysis_for_scc
    process_top_levels(graph, scc, patches)
  File "C:\Users\alexw\coding\mypy\mypy\semanal_main.py", line 199, in process_top_levels
    deferred, incomplete, progress = semantic_analyze_target(next_id, state,
  File "C:\Users\alexw\coding\mypy\mypy\semanal_main.py", line 321, in semantic_analyze_target
    with state.wrap_context(check_blockers=False):
  File "C:\Users\alexw\AppData\Local\Programs\Python\Python310\lib\contextlib.py", line 153, in __exit__
    self.gen.throw(typ, value, traceback)
  File "C:\Users\alexw\coding\mypy\mypy\build.py", line 1976, in wrap_context
    yield
  File "C:\Users\alexw\coding\mypy\mypy\semanal_main.py", line 326, in semantic_analyze_target
    analyzer.refresh_partial(refresh_node,
  File "C:\Users\alexw\coding\mypy\mypy\semanal.py", line 414, in refresh_partial
    self.refresh_top_level(node)
  File "C:\Users\alexw\coding\mypy\mypy\semanal.py", line 423, in refresh_top_level
    self.add_implicit_module_attrs(file_node)
  File "C:\Users\alexw\coding\mypy\mypy\semanal.py", line 460, in add_implicit_module_attrs
    assert isinstance(node, TypeInfo)
AssertionError:
C:\Users\alexw\coding\typeshed\stdlib\abc.pyi: : note: use --pdb to drop into pdb

I'm pretty sure that this is because of this recently merged mypy PR:

I don't want to cause problems for mypy unnecessarily, and importing (Mutable)Mapping from typing in builtins fixes it, so let's just do that for now.

@github-actions
Copy link
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

@AlexWaygood AlexWaygood merged commit 617d2aa into python:master Apr 18, 2022
@AlexWaygood AlexWaygood deleted the fix-mypy branch April 18, 2022 16:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants