Thanks to visit codestin.com
Credit goes to github.com

Skip to content

AttributeError: attribute 'arguments' of 'FuncDef' undefined #11449

Closed
@intgr

Description

@intgr

Using a development mypy version: 0.920+dev.5703becbbe9be5006ed0d2d998dd4a793f1aedd0

Code similar to:

from typing import Any

from xxx.commands import XxxBaseCommand


class Command(XxxBaseCommand):
    def handle(  # type: ignore[override]
        self,
        a: int,
        b: str,
        c: str,
        *args: Any,
        **options: Any,
    ) -> None:
        pass

Causes an internal error:

Traceback (most recent call last):
  File "mypy/checker.py", line 421, in accept
  File "mypy/nodes.py", line 721, in accept
  File "mypy/checker.py", line 753, in visit_func_def
  File "mypy/checker.py", line 764, in _visit_func_def
  File "mypy/checker.py", line 1457, in check_method_override
  File "mypy/checker.py", line 1485, in check_method_or_accessor_override_for_base
  File "mypy/checker.py", line 1561, in check_method_override_for_base_with_name
  File "mypy/checker.py", line 1723, in check_override
  File "mypy/messages.py", line 839, in signature_incompatible_with_supertype
  File "mypy/messages.py", line 861, in pretty_callable_or_overload
  File "mypy/messages.py", line 1931, in pretty_callable
AttributeError: attribute 'arguments' of 'FuncDef' undefined

I tried to reduce the example, but it cutting it down to a minimal reproducer turned out to be complicated, after some changes it no longer appears. Let me know if you need a better reproducer and I'll see what I can do.

Your Environment

  • Mypy version used: 5703bec
  • Python version used: 3.10.0
  • Operating system and version: macOS

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions