diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2001-04-24 06:44:13 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2001-04-24 06:44:13 +0000 |
commit | be712bae3a4af4161efc5cb48f6a2f62ef12d925 (patch) | |
tree | 5d75bff5b5014e4e1581e61e05c6803fffb7709f /object.c | |
parent | 81e661b298177105d915a1fe8e1e47ddd0a46122 (diff) |
* ruby.c (set_arg0): wrong predicate when new $0 value is bigger
than original space.
* gc.c (id2ref): should use NUM2ULONG()
* object.c (rb_mod_const_get): check whether name is a class
variable name.
* object.c (rb_mod_const_set): ditto.
* object.c (rb_mod_const_defined): ditto.
* marshal.c (w_float): precision changed to "%.16g"
* eval.c (rb_call0): wrong retry behavior.
* numeric.c (fix_aref): a bug on long>int architecture.
* eval.c (rb_eval_string_wrap): should restore ruby_wrapper.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_6@1333 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'object.c')
-rw-r--r-- | object.c | 21 |
1 files changed, 18 insertions, 3 deletions
@@ -752,14 +752,24 @@ static VALUE rb_mod_const_get(mod, name) VALUE mod, name; { - return rb_const_get(mod, rb_to_id(name)); + ID id = rb_to_id(name); + + if (!rb_is_const_id(id)) { + rb_raise(rb_eNameError, "wrong constant name %s", name); + } + return rb_const_get(mod, id); } static VALUE rb_mod_const_set(mod, name, value) VALUE mod, name, value; { - rb_const_set(mod, rb_to_id(name), value); + ID id = rb_to_id(name); + + if (!rb_is_const_id(id)) { + rb_raise(rb_eNameError, "wrong constant name %s", name); + } + rb_const_set(mod, id, value); return value; } @@ -767,7 +777,12 @@ static VALUE rb_mod_const_defined(mod, name) VALUE mod, name; { - return rb_const_defined_at(mod, rb_to_id(name)); + ID id = rb_to_id(name); + + if (!rb_is_const_id(id)) { + rb_raise(rb_eNameError, "wrong constant name %s", name); + } + return rb_const_defined_at(mod, id); } static VALUE |