Skip to content

Mypy 2.4 fails when using native parser #298

Open

Description

@bkeryan

Bug Report

Mypy 2.4.0 enables the native parser by default, and in #287 I had to disable it to get this project to successfully type-check.

Repro or Code Sample

N/A

Expected Behavior

Mypy works without specifying this in pyproject.toml:

show_traceback = true
native_parser = false

Current Behavior

Without disabling native_parser, it fails with

Run poetry run mypy
  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: 2.4.0
  note: use --pdb to drop into pdb
  Traceback (most recent call last):
    File "<frozen runpy>", line 201, in _run_module_as_main
    File "<frozen runpy>", line 87, in _run_code
    File "D:\a\nitypes-python\nitypes-python\.venv\Lib\site-packages\mypy\__main__.py", line 16, in console_entry
      main()
      ~~~~^^
    File "mypy\main.py", line 167, in main
    File "mypy\main.py", line 257, in run_build
      res = build.build(sources, options, None, flush_errors, fscache, stdout, stderr)
    File "mypy\build.py", line 425, in build
    File "mypy\build.py", line 540, in build_inner
      graph = dispatch(sources, manager, stdout, connect_threads)
    File "mypy\build.py", line 4127, in dispatch
      graph = load_graph(sources, manager)
    File "mypy\build.py", line 4360, in load_graph
      manager.parse_all([state for state in new if state.needs_parse])
    File "mypy\build.py", line 1049, in parse_all
      parallel_parsed_states, parallel_parsed_states_set = self.parse_files_threaded_raw(
    File "mypy\build.py", line 1128, in parse_files_threaded_raw
      fut.result()
    File "C:\hostedtoolcache\windows\Python\3.15.0\x64\Lib\concurrent\futures\_base.py", line 447, in result
      return self.__get_result()
             ~~~~~~~~~~~~~~~~~^^
    File "C:\hostedtoolcache\windows\Python\3.15.0\x64\Lib\concurrent\futures\_base.py", line 396, in __get_result
      raise self._exception
    File "C:\hostedtoolcache\windows\Python\3.15.0\x64\Lib\concurrent\futures\thread.py", line 86, in run
      result = ctx.run(self.task)
    File "C:\hostedtoolcache\windows\Python\3.15.0\x64\Lib\concurrent\futures\thread.py", line 73, in run
      return fn(*args, **kwargs)
    File "mypy\build.py", line 3239, in parse_file_inner
      self.tree = self.manager.parse_file(
    File "mypy\build.py", line 1282, in parse_file
      tree = parse(source, path, id, self.errors, options=options)
    File "mypy\parse.py", line 35, in parse
    File "mypy\nativeparse.py", line 24, in <module>
    File "D:\a\nitypes-python\nitypes-python\.venv\Lib\site-packages\ast_serialize\__init__.py", line 1, in <module>
      from .ast_serialize import *
  ImportError: DLL load failed while importing ast_serialize: The specified module could not be found.

Possible Solution

Context

Your Environment

  • nitypes version: main
  • Python version: 3.15.0

AB#4151733

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions