1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* 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
This commit is contained in:
matz 2006-08-30 09:46:57 +00:00
parent 51525e12b8
commit e8f43ad081
3 changed files with 18 additions and 6 deletions

View file

@ -65,6 +65,16 @@ Fri Aug 25 16:05:50 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
* object.c (sym_call): check if the receiver is given.
Fri Aug 25 01:10:11 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
* 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.
Wed Aug 23 00:25:14 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
* lib/rexml/source.rb (REXML::IOSource#initialize): encoding have to

View file

@ -1501,7 +1501,7 @@ end
config_string('COMMON_HEADERS') do |s|
Shellwords.shellwords(s).each {|s| hdr << "#include <#{s}>"}
end
COMMON_HEADERS = (hdr.join("\n") unless hdr.empty?)
COMMON_HEADERS = if hdr.empty? then "" else hdr.join("\n") end
COMMON_LIBS = config_string('COMMON_LIBS', &split) || []
COMPILE_RULES = config_string('COMPILE_RULES', &split) || %w[.%s.%s:]

View file

@ -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;
}