summaryrefslogtreecommitdiff
path: root/proc.c
diff options
context:
space:
mode:
authorPeter Zhu <peter.zhu@shopify.com>2021-04-07 18:25:16 +0000
committerPeter Zhu <peter@peterzhu.ca>2021-04-07 15:16:58 -0400
commitd8a13e504992a45d52063f7c925408d7aad3595a (patch)
tree2a5691c5fde93b6df53446b139accadec3ea7104 /proc.c
parent587e6800086764a1b7c959976acef33e230dccc2 (diff)
[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.
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/4364
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 b266365f40..390c67424e 100644
--- a/proc.c
+++ b/proc.c
@@ -3227,7 +3227,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;