This commit changed the definition of abstractclassmethod and abstractstaticmethod in a way that makes them no longer callable. That means they cannot be used with other decorators (like property) that require a callable.
The following previously type checked without errors, but it no longer works.
The new declaration of abstractclassmethod and abstractstaticmethod also completely obscure the signature of the function they're decorating, which is a big problem for type checking (and completion suggestions, etc.).
I recommend reverting the change for abstractclassmethod and abstractstaticmethod. If there is a compelling reason to wrap these in a class, then the class should be parameterized with a ParamSpec and should include a __call__ method so it is still callable. @srittau, do you have a preference?
I won't be able to incorporate the latest typeshed stubs into pyright or pylance until this is addressed because this regression results in significant problems for internal Microsoft code bases.
Digging into this further, most of the uses of abstractclassmethod and abstractstaticmethod in our internal code base were inappropriate uses. These decorators are deprecated as of Python 3.2, so they shouldn't generally be used. But I think the recent change is still problematic.
Activity
erictraut commented on Feb 5, 2022
Digging into this further, most of the uses of abstractclassmethod and abstractstaticmethod in our internal code base were inappropriate uses. These decorators are deprecated as of Python 3.2, so they shouldn't generally be used. But I think the recent change is still problematic.
srittau commented on Feb 5, 2022
These problems seem to be inherited from classmethod/staticmethod, which are also lacking __call__ in the stubs, although they exist at runtime.
There was a PR previously that used ParamSpec, but it was abandoned since at that time mypy's ParamSpec-support was lacking.
I will send a PR later to resolve these issues.