Commit e7694fd
Fix defined? for protected methods defined in a module
me->defined_class is 0 for methods stored on a module, so the
protected visibility check in vm_defined always failed and defined?
returned nil even when the call would succeed.
Use rb_callable_method_entry_with_refinements (where defined_class is
populated) and the same vm_defined_class_for_protected_call helper as
the call path. defined? now agrees with whether the method could
actually be called.
[Backport #22076]1 parent a08f356 commit e7694fd
2 files changed
Lines changed: 33 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
65 | 93 | | |
66 | 94 | | |
67 | 95 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5585 | 5585 | | |
5586 | 5586 | | |
5587 | 5587 | | |
5588 | | - | |
| 5588 | + | |
5589 | 5589 | | |
5590 | | - | |
5591 | | - | |
| 5590 | + | |
| 5591 | + | |
5592 | 5592 | | |
5593 | 5593 | | |
5594 | 5594 | | |
5595 | | - | |
| 5595 | + | |
5596 | 5596 | | |
5597 | 5597 | | |
5598 | 5598 | | |
5599 | 5599 | | |
5600 | 5600 | | |
5601 | 5601 | | |
5602 | | - | |
| 5602 | + | |
5603 | 5603 | | |
5604 | 5604 | | |
5605 | 5605 | | |
| |||
0 commit comments