Skip to content

Crash on master branch when using --custom-typeshed-dir with a relative path #13295

Closed
@AlexWaygood

Description

@AlexWaygood

Crash Report

If you try to check typeshed with stubtest using the mypy master branch, it crashes. This is a result of the changes made in #13155.

Traceback

(venv) C:\Users\alexw\coding\typeshed>python -m mypy.stubtest --check-typeshed --custom-typeshed-dir .
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\stubtest.py", line 1650, in <module>
    sys.exit(main())
  File "c:\users\alexw\coding\mypy\mypy\stubtest.py", line 1646, in main
    return test_stubs(parse_options(sys.argv[1:]))
  File "c:\users\alexw\coding\mypy\mypy\stubtest.py", line 1508, in test_stubs
    modules = build_stubs(modules, options, find_submodules=not args.check_typeshed)
  File "c:\users\alexw\coding\mypy\mypy\stubtest.py", line 1381, in build_stubs
    res = mypy.build.build(sources=sources, options=options)
  File "c:\users\alexw\coding\mypy\mypy\build.py", line 186, in build
    result = _build(
  File "c:\users\alexw\coding\mypy\mypy\build.py", line 250, in _build
    manager = BuildManager(
  File "c:\users\alexw\coding\mypy\mypy\build.py", line 677, in __init__
    if os.path.commonpath((path, custom_typeshed_dir)) == custom_typeshed_dir:
  File "C:\Users\alexw\AppData\Local\Programs\Python\Python310\lib\ntpath.py", line 772, in commonpath
    raise ValueError("Can't mix absolute and relative paths") from None
ValueError: Can't mix absolute and relative paths

To Reproduce

  • cd into a local clone of mypy, checkout the master branch
  • Activate a virtual environment with an editable install of mypy.
  • cd into a local clone of typeshed.
  • run python -m mypy.stubtest --check-typeshed --custom-typeshed-dir .

Your Environment

  • Mypy version used: commit cbabbf7
  • Python version used: 3.10
  • Operating system and version: Windows

Cc. @hauntsaninja, @podshumok, @ilevkivskyi

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions