Repository navigation
Skip arg count checks for dynamic functions. - #1433
Conversation
|
Yeah, this is probably a reasonable thing to do, as type checking calls is prone to false positives. We can revisit this later if/when stubs are in good enough shape that false positives are no longer a significant problem. The code that causes mypy to always type check calls is this fragment in Modifying it to this should result in calls not being type checked, and it would be cleaner than this PR: |
80991e6 to
55ba0ed
Compare
|
@JukkaL Can you look at the failures? They're all from testtypegen, and seem regular fallout from the lesser checking in dynamic functions. I'll see if I can brute-force fix them and push another, but I'd like you to review that. |
|
I'll look at the failures later today. testtypegen is expected to fail, as one of the things that it tests is that types of functions are exported from unannotated functions, which no longer happens after this PR. We can just remove or update those test cases, as we don't care about the types any more. |
|
After the fix, the exported types aren't correct for generic functions in unannotated code. However, we don't rely on these types anywhere, so I'd suggest merging this PR and creating a new issue for fixing the exported types that refers to this PR. |
Another followup for #1415 (fixing #1334).
I'm not at all sure this is the right thing to do. But we should honor the simple promise implied by the docs and by PEP 484 (even if not made very explicit) that the body of dynamic (unannotated) functions is not checked.
There are probably many other errors that are produced by the type checker for dynamic functions. But suppressing this one and #1431 are on at the top of the wishlist of our internal customers.