#21948·mypy

New parser deviates from old parser in edge cases with function type comments

Author: ilevkivskyiCreated Sep 6, 2026Updated Sep 12, 2026
Labelsbugtopic-parser

This is a follow-up for https://github.com/python/mypy/pull/21823. Most notably we get a false negative in situations like this:

python
class A:
    def f(self):
        # type: () -> None
        def g(x):
            # type: () -> None  # Error not detected: signature has too few parameters
            pass

cc @JukkaL