ruby-changes:17133
From: nobu <ko1@a...>
Date: Sun, 29 Aug 2010 12:20:11 +0900 (JST)
Subject: [ruby-changes:17133] Ruby:r29133 (trunk): * load.c (load_failed): should honor encoding.
nobu 2010-08-29 12:20:04 +0900 (Sun, 29 Aug 2010) New Revision: 29133 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=29133 Log: * load.c (load_failed): should honor encoding. [ruby-core:31915] Modified files: trunk/ChangeLog trunk/load.c trunk/test/ruby/test_require.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 29132) +++ ChangeLog (revision 29133) @@ -1,3 +1,7 @@ +Sun Aug 29 12:19:58 2010 Nobuyoshi Nakada <nobu@r...> + + * load.c (load_failed): should honor encoding. [ruby-core:31915] + Sun Aug 29 09:35:10 2010 NARUSE, Yui <naruse@r...> * common.mk (clean): exclude *.inc. [ruby-dev:41931] Index: load.c =================================================================== --- load.c (revision 29132) +++ load.c (revision 29133) @@ -551,8 +551,9 @@ static void load_failed(VALUE fname) { - rb_raise(rb_eLoadError, "cannot load such file -- %s", - RSTRING_PTR(fname)); + VALUE mesg = rb_str_buf_new_cstr("cannot load such file -- "); + rb_str_append(mesg, fname); /* should be ASCII compatible */ + rb_exc_raise(rb_exc_new3(rb_eLoadError, mesg)); } static VALUE Index: test/ruby/test_require.rb =================================================================== --- test/ruby/test_require.rb (revision 29132) +++ test/ruby/test_require.rb (revision 29133) @@ -40,6 +40,12 @@ end end + def test_require_nonascii + bug3758 = '[ruby-core:31915]' + e = assert_raise(LoadError, bug3758) {require "\u{221e}"} + assert_match(/\u{221e}\z/, e.message, bug3758) + end + def test_require_path_home env_rubypath, env_home = ENV["RUBYPATH"], ENV["HOME"] -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/