Cannot determine type of function with too many redefinitions #9721
Labels
addressed in next version
Issue is fixed and will appear in next published version
bug
Something isn't working
Describe the bug
If a function is (re)defined 17 or more times through a decorator and is invoked between the first and the last definition, pyright reports
Type of "f" could not be determined because it refers to itself
Code or Screenshots
The following is a minimized version of a (believe it or not) real-world case, from a Jupyter notebook.
Note that
reportRedeclaration
is disabled globally, otherwise all definitions save for the last one would report an error.Code spoiler
A few notes:
f
is anywhere after the first definition and before the last one; callingf
after the last definition is okf: Callable[[], None]
before the first definition is also inconsequential.I suppose this is simply encountering some internal limits of pyright, but I thought it'd be better to let you know just in case, because this behavior seems slightly weird.
VS Code extension or command-line
Python version: 3.13.1
Pyright version: from 1.1.386 to 1.1.392; 1.1.385 reports no errors
The text was updated successfully, but these errors were encountered: