Commit e4c2668
authored
Call get_method_hook when methods are used in decorators (#10675)
When a method is used in a decorator, pass the full name to plugins
through the get_method_hook function, just like we would normally do for
other places that methods got called. Previously, in these situations,
we would call get_function_hook instead with '{method_name} of
{class_name}', which loses information about which module the class is
located in, and gives information about a method to the hook meant for
functions.
Currently this is limited to situations where the method is accessed in
the decorator itself, so
@obj.meth
def f() -> None: ...
would work but
method = obj.meth
@method
def f() -> None: ...
probably wouldn't work.1 parent 08e6ba8 commit e4c2668
3 files changed
Lines changed: 47 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3596 | 3596 | | |
3597 | 3597 | | |
3598 | 3598 | | |
| 3599 | + | |
| 3600 | + | |
| 3601 | + | |
| 3602 | + | |
| 3603 | + | |
| 3604 | + | |
3599 | 3605 | | |
3600 | 3606 | | |
3601 | 3607 | | |
3602 | | - | |
| 3608 | + | |
| 3609 | + | |
3603 | 3610 | | |
3604 | 3611 | | |
3605 | 3612 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
783 | 783 | | |
784 | 784 | | |
785 | 785 | | |
| 786 | + | |
| 787 | + | |
| 788 | + | |
| 789 | + | |
| 790 | + | |
| 791 | + | |
| 792 | + | |
| 793 | + | |
| 794 | + | |
| 795 | + | |
| 796 | + | |
| 797 | + | |
| 798 | + | |
| 799 | + | |
| 800 | + | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
| 805 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
0 commit comments