summaryrefslogtreecommitdiff
path: root/proc.c
diff options
context:
space:
mode:
authornagachika <nagachika@ruby-lang.org>2021-05-23 14:59:26 +0900
committernagachika <nagachika@ruby-lang.org>2021-05-23 14:59:26 +0900
commit410216c9db033a72f4dd119c366bc58dd54383ec (patch)
tree3d99806de5ceadea0dbdfa78fe74a814d841ee3f /proc.c
parentfc73fc79cbaee6674256589b7cfe53d20b638a05 (diff)
merge revision(s) d8a13e504992a45d52063f7c925408d7aad3595a: [Backport #17780]
[Bug #17780] Fix Method#super_method for module alias Method#super_method crashes for aliased module methods because they are not defined on a class. This bug was introduced in c60aaed1856b2b6f90de0992c34771830019e021 as part of bug #17130. --- proc.c | 2 +- test/ruby/test_method.rb | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-)
Diffstat (limited to 'proc.c')
-rw-r--r--proc.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/proc.c b/proc.c
index d3310e8621..a933fde3a8 100644
--- a/proc.c
+++ b/proc.c
@@ -3199,7 +3199,7 @@ method_super_method(VALUE method)
TypedData_Get_Struct(method, struct METHOD, &method_data_type, data);
iclass = data->iclass;
if (!iclass) return Qnil;
- if (data->me->def->type == VM_METHOD_TYPE_ALIAS) {
+ if (data->me->def->type == VM_METHOD_TYPE_ALIAS && data->me->defined_class) {
super_class = RCLASS_SUPER(rb_find_defined_class_by_owner(data->me->defined_class,
data->me->def->body.alias.original_me->owner));
mid = data->me->def->body.alias.original_me->def->original_id;