Skip to content

Commit

Permalink
class.c: err if superclass is 0
Browse files Browse the repository at this point in the history
* class.c (rb_define_class, rb_define_class_id_under): raise
  ArgumentError if super is 0, deprecated behavior which has been
  warned long time.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54015 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
nobu committed Mar 7, 2016
1 parent 8e1a085 commit 9bb8f28
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
6 changes: 6 additions & 0 deletions ChangeLog
@@ -1,3 +1,9 @@
Mon Mar 7 13:32:58 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>

* class.c (rb_define_class, rb_define_class_id_under): raise
ArgumentError if super is 0, deprecated behavior which has been
warned long time.

Mon Mar 7 13:28:30 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>

* internal.h: move function declarations for class internals from
Expand Down
6 changes: 3 additions & 3 deletions class.c
Expand Up @@ -660,7 +660,7 @@ rb_define_class(const char *name, VALUE super)
return klass;
}
if (!super) {
rb_warn("no super class for `%s', Object assumed", name);
rb_raise(rb_eArgError, "no super class for `%s'", name);
}
klass = rb_define_class_id(id, super);
rb_vm_add_root_module(id, klass);
Expand Down Expand Up @@ -732,8 +732,8 @@ rb_define_class_id_under(VALUE outer, ID id, VALUE super)
return klass;
}
if (!super) {
rb_warn("no super class for `%"PRIsVALUE"::%"PRIsVALUE"', Object assumed",
rb_class_path(outer), rb_id2str(id));
rb_raise(rb_eArgError, "no super class for `%"PRIsVALUE"::%"PRIsVALUE"'",
rb_class_path(outer), rb_id2str(id));
}
klass = rb_define_class_id(id, super);
rb_set_class_path_string(klass, outer, rb_id2str(id));
Expand Down

0 comments on commit 9bb8f28

Please sign in to comment.