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
version 0.930 regression: INTERNAL ERROR AttributeError: attribute 'arguments' of 'FuncDef' undefined #11899
.../entityproperty.py:273: 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.930
Traceback (most recent call last):
File "/usr/lib/python3.8/runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/lib/python3.8/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "mypy/checker.py", line 420, in accept
File "mypy/nodes.py", line 727, in accept
File "mypy/checker.py", line 770, in visit_func_def
File "mypy/checker.py", line 781, in _visit_func_def
File "mypy/checker.py", line 1469, in check_method_override
File "mypy/checker.py", line 1497, in check_method_or_accessor_override_for_base
File "mypy/checker.py", line 1583, in check_method_override_for_base_with_name
File "mypy/checker.py", line 1745, 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 1937, in pretty_callable
AttributeError: attribute 'arguments' of 'FuncDef' undefined
.../entityproperty.py:273: : note: use --pdb to drop into pdb
Looks to me like it's saying your class has a method (I assume this update method?) which is incompatible with the class it is inheriting from. And then, when it tries to print the superclass method, it... the superclass method isn't fully cached or something?
I think @hauntsaninja's bug is #7045 -- though if it's a 0.930 regression then maybe not. (why'd I remember this? Cause I noticed the transformers install though I doubt that's why :^)
Nice spot! Yeah, that should account for the second stacktrace. The first stacktrace, which is what the repro gives is #10521 and #9081 . It is not a regression since 0.930, I just got fooled by the timing of it popping up in this codebase. Sorry for cluttering up this issue!
Then run mypy -m app.b twice. The first one will fail with Signature of "frobnicate" incompatible with supertype as expected, the second time triggers an INTERNAL ERROR:
(3.9.4-devtools) fperrin-laptop:/tmp/repro-11899% mypy -m app.b
app/b.py:3: error: Signature of "frobnicate" incompatible with supertype "Foo"
app/b.py:3: note: Superclass:
app/b.py:3: note: def frobnicate(self, *args: Any, **kwargs: Any) -> Any
app/b.py:3: note: Subclass:
app/b.py:3: note: def frobnicate(self) -> None
Found 1 error in 1 file (checked 1 source file)
zsh: exit 1 mypy -m app.b
(3.9.4-devtools) fperrin-laptop:/tmp/repro-11899% mypy -m app.b
app/b.py:3: error: Signature of "frobnicate" incompatible with supertype "Foo"
app/b.py:3: note: Superclass:
/private/tmp/repro-11899/app/b.py:3: error: INTERNAL ERROR -- Please try using mypy master on Github:
https://mypy.readthedocs.io/en/stable/common_issues.html#using-a-development-mypy-build
If this issue continues with mypy master, please report a bug at https://github.com/python/mypy/issues
version: 0.950+dev.4a744b35e28277e2193feb78de90d3b3cbb3169b
/private/tmp/repro-11899/app/b.py:3: : note: please use --show-traceback to print a traceback when reporting a bug
zsh: exit 2 mypy -m app.b
I just tried with version: 0.950+dev.4a744b35e28277e2193feb78de90d3b3cbb3169b.
Since we upgraded to mypy 0.960 over at typeshed, I now (for some reason) hit this crash every time I run mypy_test.py twice in a row locally. It's always the exact same traceback as in this issue, and it always occurs when mypy runs on our Flask-SQLAlchemy stubs.
Should be fixed by #12324. Let me know if anyone has a repro of bad behaviour against current master. And thanks again to @fperrin for finding a minimal repro and making a fix!
Activity
A5rocks commentedon Jan 5, 2022
Looks to me like it's saying your class has a method (I assume this
updatemethod?) which is incompatible with the class it is inheriting from. And then, when it tries to print the superclass method, it... the superclass method isn't fully cached or something?Not sure -- does clearing the cache fix this?
arielf commentedon Jan 5, 2022
Thank you so much!
Confirming. Both of the below solutions worked for me:
Thanks again. This comment was very helpful.
arielf commentedon Jan 5, 2022
Sorry I have to take workaround (2) above back.
It solved the issue only for the 1st run (empty cache)
If I rerun mypy, even on a fresh cache (created by mypy-0.930) I get the INTERNAL ERROR again.
so the only real workaroud is (1) above: downgrade back to mypy-0.920
hauntsaninja commentedon Jan 7, 2022
hauntsaninja commentedon Jan 7, 2022
Okay, not fully minimal, but I think at least the following should get you a crash:
A5rocks commentedon Jan 7, 2022
I think @hauntsaninja's bug is #7045 -- though if it's a 0.930 regression then maybe not. (why'd I remember this? Cause I noticed the
transformersinstall though I doubt that's why :^)hauntsaninja commentedon Jan 7, 2022
Nice spot! Yeah, that should account for the second stacktrace. The first stacktrace, which is what the repro gives is #10521 and #9081 . It is not a regression since 0.930, I just got fooled by the timing of it popping up in this codebase. Sorry for cluttering up this issue!
fperrin commentedon Mar 9, 2022
I believe I have a small repro case for this internal crash:
Then run
mypy -m app.btwice. The first one will fail withSignature of "frobnicate" incompatible with supertypeas expected, the second time triggers an INTERNAL ERROR:I just tried with
version: 0.950+dev.4a744b35e28277e2193feb78de90d3b3cbb3169b.Demonstrate issue for incremental checking of bad overload
Don't use tp.definition.arguments in pretty_callable
Make FuncItem.arguments optional
Make FuncItem.arguments optional
Make FuncItem.arguments optional
KotlinIsland commentedon May 20, 2022
This looks like a duplicate of #11449
Make FuncItem.arguments optional
Do not delete FuncItem.arguments on deserialize
fperrin commentedon May 20, 2022
It does indeed. I have a proposed fix in #12324, I need to rebase because after recent changes to mypy master.
Do not delete FuncItem.arguments on deserialize
Do not delete FuncItem.arguments on deserialize
AlexWaygood commentedon May 27, 2022
Since we upgraded to mypy 0.960 over at typeshed, I now (for some reason) hit this crash every time I run
mypy_test.pytwice in a row locally. It's always the exact same traceback as in this issue, and it always occurs when mypy runs on ourFlask-SQLAlchemystubs.Do not delete FuncItem.arguments on deserialize
hauntsaninja commentedon Jun 29, 2022
Should be fixed by #12324. Let me know if anyone has a repro of bad behaviour against current master. And thanks again to @fperrin for finding a minimal repro and making a fix!