diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2006-08-30 09:46:57 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2006-08-30 09:46:57 +0000 |
commit | e8f43ad081e35d8779666f79f01d9c59a4122c29 (patch) | |
tree | 9925d2ebe8357dc6be9329b2a7ce79aabd7970db /object.c | |
parent | 51525e12b8e61979567ccf12da300a11237ba9a3 (diff) | |
download | ruby-e8f43ad081e35d8779666f79f01d9c59a4122c29.tar.gz |
* object.c (rb_Integer): Integer(nil) should raise TypeError.
[ruby-talk:210205]
* object.c (nil_to_s): no longer returns empty string but "nil".
[ruby-talk:210205]
* lib/mkmf.rb: avoid COMMON_HEADERS being nil.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10801 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'object.c')
-rw-r--r-- | object.c | 12 |
1 files changed, 7 insertions, 5 deletions
@@ -676,17 +676,15 @@ nil_to_f(VALUE obj) /* * call-seq: - * nil.to_s => "" + * nil.to_s => "nil" * - * Always returns the empty string. - * - * nil.to_s #=> "" + * Always returns the string "nil". */ static VALUE nil_to_s(VALUE obj) { - return rb_str_new2(""); + return rb_str_new2("nil"); } /* @@ -2005,6 +2003,10 @@ rb_Integer(VALUE val) case T_STRING: return rb_str_to_inum(val, 0, Qtrue); + case T_NIL: + rb_raise(rb_eTypeError, "can't convert nil into Integer"); + break; + default: break; } |