SIGN IN SIGN UP

[mypyc] Fix function wrapper descriptor for static/class methods (#21811)

Calling an `async` class method in interpreted context might fail on
incorrect number of arguments because the class `T` on the lhs of the
member expression `T.f(a,b,c)` is not bound to the `cls` argument.
Instead the first regular argument is taken as `cls` and all other are
shifted.

Expand the `tp_descr_get` slot of the function wrapper type object to
correctly handle class methods.

Also modify the function lowering logic to take the method from the type
dictionary instead of through `getattr` when calling a decorator on the
method. `getattr` goes through the descriptor and binds the `cls`
argument but the argument should be unbound when applying the decorator
to match interpreted Python.
P
Piotr Sawicki committed
d79a9e684c86c1e8265d673c01b28ce9072f06e0
Parent: 82dd3af
Committed by GitHub <noreply@github.com> on 8/6/2026, 10:16:56 AM