* string.c (rb_String): Kernel#String should call to_str before to_s.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31209 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nagachika 2011-03-29 12:56:40 +00:00
parent d084c4f43d
commit a64103fbfe
2 changed files with 8 additions and 1 deletions

View File

@ -1,3 +1,7 @@
Tue Mar 29 21:51:31 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
* string.c (rb_String): Kernel#String should call to_str before to_s.
Tue Mar 29 10:28:08 2011 NAKAMURA Usaku <usa@ruby-lang.org>
* test/webrick/test_filehandler.rb

View File

@ -2360,7 +2360,10 @@ rb_num2dbl(VALUE val)
VALUE
rb_String(VALUE val)
{
return rb_convert_type(val, T_STRING, "String", "to_s");
VALUE tmp = rb_check_string_type(val);
if (NIL_P(tmp))
tmp = rb_convert_type(val, T_STRING, "String", "to_s");
return tmp;
}