8000 mypy plugin crashes with TypeError: mypy.types.TypeVarId object expected; got int · Issue #13 · harrymander/dataclasses-struct · GitHub 8000
[go: up one dir, main page]

Skip to content
mypy plugin crashes with TypeError: mypy.types.TypeVarId object expected; got int #13
@ExcaliburZero

Description

@ExcaliburZero

I'm running into an issue using the dataclasses-struct mypy plugin, where when running mypy it fails with the following error:

$ mypy main.py
Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.13.3/x64/bin/mypy", line 8, in <module>
    sys.exit(console_entry())
             ~~~~~~~~~~~~~^^
  File "/opt/hostedtoolcache/Python/3.13.3/x64/lib/python3.13/site-packages/mypy/__main__.py", line 15, in console_entry
    main()
    ~~~~^^
  File "mypy/main.py", line 119, in main
  File "mypy/main.py", line 203, in run_build
  File "mypy/build.py", line 191, in build
  File "mypy/build.py", line 267, in _build
  File "mypy/build.py", line 2937, in dispatch
  File "mypy/build.py", line 3335, in process_graph
  File "mypy/build.py", line 3430, in process_stale_scc
  File "mypy/semanal_main.py", line 99, in semantic_analysis_for_scc
  File "mypy/semanal_main.py", line 443, in apply_class_plugin_hooks
  File "mypy/semanal_main.py", line 479, in apply_hooks_to_class
  File "/opt/hostedtoolcache/Python/3.13.3/x64/lib/python3.13/site-packages/dataclasses_struct/ext/mypy_plugin.py", line 15, in transform_dataclass_struct
    tvd = TypeVarType(
        'T',
    ...<4 lines>...
        ctx.api.named_type('builtins.object'),
    )
  File "mypy/types.py", line 613, in __init__
TypeError: mypy.types.TypeVarId object expected; got int

For context, I'm using the following versions:

  • Python 3.13.3
  • mypy 1.15.0
  • dataclasses-struct 0.8.3

I have the plugin enabled by adding the following lines to my pyproject.toml file:

[tool.mypy]
plugins = ["dataclasses_struct.ext.mypy_plugin"]

Here is a minimal example that replicates the issue:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0