зеркало из https://github.com/github/ruby.git
* object.c (rb_to_float): prohibit conversion from nil to float.
[ruby-dev:37663] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21204 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
a413e50c41
Коммит
ce0cd6ad1f
|
@ -1,3 +1,8 @@
|
||||||
|
Wed Dec 31 00:27:54 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
|
* object.c (rb_to_float): prohibit conversion from nil to float.
|
||||||
|
[ruby-dev:37663]
|
||||||
|
|
||||||
Tue Dec 30 21:17:00 2008 Tanaka Akira <akr@fsij.org>
|
Tue Dec 30 21:17:00 2008 Tanaka Akira <akr@fsij.org>
|
||||||
|
|
||||||
* ext/socket/mkconstants.rb: use sock_define_uconst for INADDR_*
|
* ext/socket/mkconstants.rb: use sock_define_uconst for INADDR_*
|
||||||
|
|
3
object.c
3
object.c
|
@ -2273,6 +2273,9 @@ rb_to_float(VALUE val)
|
||||||
VALUE v;
|
VALUE v;
|
||||||
|
|
||||||
if (TYPE(val) == T_FLOAT) return val;
|
if (TYPE(val) == T_FLOAT) return val;
|
||||||
|
if (NIL_P(val)) {
|
||||||
|
rb_raise(rb_eTypeError, "can't convert nil into Float");
|
||||||
|
}
|
||||||
v = convert_type(val, "Float", "to_f", Qtrue);
|
v = convert_type(val, "Float", "to_f", Qtrue);
|
||||||
if (TYPE(v) != T_FLOAT) {
|
if (TYPE(v) != T_FLOAT) {
|
||||||
const char *cname = rb_obj_classname(val);
|
const char *cname = rb_obj_classname(val);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче