Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

ExtendingTraverserVisitor causesTypeError: interpreted classes cannot inherit from compiled traits #19456

Open
Labels
bugmypy got something wrong
@frebib

Description

@frebib

Bug Report

Plugin code cannot extend any of the Visitor classes

To Reproduce

frommypy.nodesimportIndexExpr,MypyFilefrommypy.pluginimportPluginfrommypy.traverserimportTraverserVisitordefplugin(_:str)->type[Plugin]:returnReproducerPluginclassReproducerPlugin(Plugin):defget_additional_deps(self,file:MypyFile)->list[tuple[int,str,int]]:classIndexVisitor(TraverserVisitor):defvisit_index_expr(self,ie:IndexExpr,/)->None:print(ie)file.accept(IndexVisitor())

Expected Behavior
It not crash

Actual Behavior

[ERROR   ] An un-handled exception was caught by Salt's global exception handler:TypeError: interpreted classes cannot inherit from compiled traitsTraceback (most recent call last):  File "venv/bin/mypy", line 8, in <module>    sys.exit(console_entry())             ~~~~~~~~~~~~~^^  File "venv/lib/python3.13/site-packages/mypy/__main__.py", line 15, in console_entry    main()    ~~~~^^  File "mypy/main.py", line 127, in main  File "mypy/main.py", line 211, in run_build  File "mypy/build.py", line 191, in build  File "mypy/build.py", line 267, in _build  File "mypy/build.py", line 2886, in dispatch  File "mypy/build.py", line 3072, in load_graph  File "mypy/build.py", line 1994, in __init__  File "mypy/build.py", line 2292, in compute_dependencies  File "mypy/plugin.py", line 845, in get_additional_deps  File "plugin/__init__.py", line 16, in get_additional_deps    file.accept(IndexVisitor())                ~~~~~~~~~~~~^^TypeError: interpreted classes cannot inherit from compiled traits

Your Environment

LOG:  Mypy Version:           1.17.0LOG:  Config File:            pyproject.tomlLOG:  Configured Executable:  venv/bin/python3.13LOG:  Current Executable:     venv/bin/python3.13LOG:  Cache Dir:              .mypy_cacheLOG:  Compiled:               TrueLOG:  Exclude:                []LOG:  Found source:           BuildSource(path='test.py', module='test', has_text=False, base_dir='.', followed=False)LOG:  Metadata abandoned for test: options differLOG:  Metadata not found for testLOG:  Parsing test.py (test)LOG:  Build finished in 0.013 seconds with 1 modules, and 0 errors

frompyproject.toml:

[tool.mypy]plugins = ["pydantic.mypy", "plugin"]strict = truenamespace_packages = truemypy_path = ".mypy-stubs/"scripts_are_modules = true
  • Python version used: 3.13

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugmypy got something wrong

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp