You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
AttributeError: attribute 'arguments' of 'FuncDef' undefined #11449
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.
I too have suddenly started seeing this with mypy 0.931 (Python 3.7 on Ubuntu). Setting incremental = false seems to have stopped the error, so it seems likely to be a caching error.
stubs\bar.pyi:4: error: Signature of "config" incompatible with supertype "Foo"
stubs\bar.pyi:4: note: Superclass:
.\stubs\bar.pyi:4: 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: 0.950
Traceback (most recent call last):
File "C:\python.install\Python310\lib\runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\python.install\Python310\lib\runpy.py", line 86, in _run_code
exec(code, run_globals)
File "mypy\checker.py", line 425, in accept
File "mypy\nodes.py", line 740, in accept
File "mypy\checker.py", line 776, in visit_func_def
File "mypy\checker.py", line 787, in _visit_func_def
File "mypy\checker.py", line 1494, in check_method_override
File "mypy\checker.py", line 1522, in check_method_or_accessor_override_for_base
File "mypy\checker.py", line 1608, in check_method_override_for_base_with_name
File "mypy\checker.py", line 1770, in check_override
File "mypy\messages.py", line 876, in signature_incompatible_with_supertype
File "mypy\messages.py", line 898, in pretty_callable_or_overload
File "mypy\messages.py", line 2019, in pretty_callable
AttributeError: attribute 'arguments' of 'FuncDef' undefined
.\stubs\bar.pyi:4: : note: use --pdb to drop into pdb
When run with command mypy --no-incremental ., the output is:
stubs\bar.pyi:4: error: Signature of "config" incompatible with supertype "Foo"
stubs\bar.pyi:4: note: Superclass:
stubs\bar.pyi:4: note: def config(self, **foo: Any) -> Any
stubs\bar.pyi:4: note: Subclass:
stubs\bar.pyi:4: note: def config(self, baz: str = ...) -> Any
Found 1 error in 1 file (checked 2 source files)
and using master:
stubs\bar.pyi:4: error: Signature of "config" incompatible with supertype "Foo"
stubs\bar.pyi:4: note: Superclass:
.\stubs\bar.pyi:4: 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: 0.960+dev.74cfa3d46ae6a9c0033bf95d88462619bc3bc044
Traceback (most recent call last):
File "C:\python.install\Python310\lib\runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\python.install\Python310\lib\runpy.py", line 86, in _run_code
exec(code, run_globals)
File "C:\my.venv\Scripts\mypy.exe\__main__.py", line 7, in <module>
sys.exit(console_entry())
File "C:\my.venv\lib\site-packages\mypy\__main__.py", line 12, in console_entry
main(None, sys.stdout, sys.stderr)
File "C:\my.venv\lib\site-packages\mypy\main.py", line 96, in main
res, messages, blockers = run_build(sources, options, fscache, t0, stdout, stderr)
File "C:\my.venv\lib\site-packages\mypy\main.py", line 173, in run_build
res = build.build(sources, options, None, flush_errors, fscache, stdout, stderr)
File "C:\my.venv\lib\site-packages\mypy\build.py", line 181, in build
result = _build(
File "C:\my.venv\lib\site-packages\mypy\build.py", line 257, in _build
graph = dispatch(sources, manager, stdout)
File "C:\my.venv\lib\site-packages\mypy\build.py", line 2755, in dispatch
process_graph(graph, manager)
File "C:\my.venv\lib\site-packages\mypy\build.py", line 3113, in process_graph
process_stale_scc(graph, scc, manager)
File "C:\my.venv\lib\site-packages\mypy\build.py", line 3220, in process_stale_scc
if not graph[id].type_check_second_pass():
File "C:\my.venv\lib\site-packages\mypy\build.py", line 2230, in type_check_second_pass
return self.type_checker().check_second_pass()
File "C:\my.venv\lib\site-packages\mypy\checker.py", line 374, in check_second_pass
self.check_partial(node)
File "C:\my.venv\lib\site-packages\mypy\checker.py", line 385, in check_partial
self.accept(node)
File "C:\my.venv\lib\site-packages\mypy\checker.py", line 430, in accept
stmt.accept(self)
File "C:\my.venv\lib\site-packages\mypy\nodes.py", line 748, in accept
return visitor.visit_func_def(self)
File "C:\my.venv\lib\site-packages\mypy\checker.py", line 781, in visit_func_def
self._visit_func_def(defn)
File "C:\my.venv\lib\site-packages\mypy\checker.py", line 792, in _visit_func_def
self.check_method_override(defn)
File "C:\my.venv\lib\site-packages\mypy\checker.py", line 1499, in check_method_override
if self.check_method_or_accessor_override_for_base(defn, base):
File "C:\my.venv\lib\site-packages\mypy\checker.py", line 1527, in check_method_or_accessor_override_for_base
if self.check_method_override_for_base_with_name(defn, name, base):
File "C:\my.venv\lib\site-packages\mypy\checker.py", line 1613, in check_method_override_for_base_with_name
self.check_override(typ,
File "C:\my.venv\lib\site-packages\mypy\checker.py", line 1775, in check_override
self.msg.signature_incompatible_with_supertype(
File "C:\my.venv\lib\site-packages\mypy\messages.py", line 845, in signature_incompatible_with_supertype
self.pretty_callable_or_overload(original, context, offset=ALIGN_OFFSET + 2 * OFFSET,
File "C:\my.venv\lib\site-packages\mypy\messages.py", line 867, in pretty_callable_or_overload
self.note(pretty_callable(tp), context,
File "C:\my.venv\lib\site-packages\mypy\messages.py", line 1979, in pretty_callable
definition_args = [arg.variable.name for arg in tp.definition.arguments]
AttributeError: 'FuncDef' object has no attribute 'arguments'
.\stubs\bar.pyi:4: : note: use --pdb to drop into pdb
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: 0.950
Traceback (most recent call last):
File "mypy/checker.py", line 425, in accept
File "mypy/nodes.py", line 740, in accept
File "mypy/checker.py", line 776, in visit_func_def
File "mypy/checker.py", line 787, in _visit_func_def
File "mypy/checker.py", line 1494, in check_method_override
File "mypy/checker.py", line 1522, in check_method_or_accessor_override_for_base
File "mypy/checker.py", line 1608, in check_method_override_for_base_with_name
File "mypy/checker.py", line 1770, in check_override
File "mypy/messages.py", line 876, in signature_incompatible_with_supertype
File "mypy/messages.py", line 898, in pretty_callable_or_overload
File "mypy/messages.py", line 2019, in pretty_callable
AttributeError: attribute 'arguments' of 'FuncDef' undefined
with mypy 0.950, Python 3.8.13, and MacOS Ventura (13.5.1). Deleting the mypy cache (the folder .mypy_cache) seems to have solved the issue, although I have no idea why.
@AlexWaygood Yes, I know, but there are systems that use old dependencies, and sometimes it's not easy or possible to update them. In our case, we will be updating this dependency soon, but still I wanted to point out the issue still occurs with that mypy version and how I solved it.
Would be great if someone explained why this issue is even occurring
Activity
sobolevn commentedon Nov 3, 2021
This might happen because sometimes
argumentsare deleted fromFuncDef:mypy/mypy/nodes.py
Lines 756 to 758 in e324460
It might happen after
FuncDefis loaded from cache, for example.domdfcoding commentedon Jan 28, 2022
I too have suddenly started seeing this with mypy 0.931 (Python 3.7 on Ubuntu). Setting
incremental = falseseems to have stopped the error, so it seems likely to be a caching error.sobolevn commentedon Jan 28, 2022
@domdfcoding please, report a new issue about your case 🙂
Reproduction will be very helpful!
Zeckie commentedon May 18, 2022
I'm getting the same error, and can reproduce with mypy 0.950 (Python 3.10.2, Windows) and the following stubs:
stubs\foo.pyi
stubs\bar.pyi
mypy config in pyproject.toml
Command:
mypy . --show-tracebackOutput:
When run with command
mypy --no-incremental ., the output is:and using master:
fperrin commentedon May 20, 2022
I have a PR open which fixes (I beleive) this issue: #12324
asottile-sentry commentedon Jun 13, 2022
also hitting this -- a
# type: ignore[override]on the line fortunately works around it (or deleting the cache)AlexWaygood commentedon Jun 29, 2022
Should hopefully be fixed by #12324 (let me know if anybody can still reproduce the issue on master!)
nbro10 commentedon Sep 19, 2023
I was getting this error
with mypy 0.950, Python 3.8.13, and MacOS Ventura (13.5.1). Deleting the mypy cache (the folder
.mypy_cache) seems to have solved the issue, although I have no idea why.AlexWaygood commentedon Sep 19, 2023
that is a very old version of mypy
nbro10 commentedon Sep 19, 2023
@AlexWaygood Yes, I know, but there are systems that use old dependencies, and sometimes it's not easy or possible to update them. In our case, we will be updating this dependency soon, but still I wanted to point out the issue still occurs with that mypy version and how I solved it.
AlexWaygood commentedon Sep 19, 2023
there was a bug in mypy's logic for deserialising objects from the mypy cache. the bug was fixed over a year ago in #12324.