[#41278] [BUG:1.9] BINARY should not be ASCII-compatible — Yugui <yugui@...>

WXVndWkbJEIkRyQ5ISMbKEIKCgo+IBskQiRHISIkKiQqJGAkTSQzJDMkXiRHJE41RE9AJEclKyVQ

15 messages 2010/05/11

[#41407] [Bug #3339] win32ole test failure — Usaku NAKAMURA <redmine@...>

Bug #3339: win32ole test failure

20 messages 2010/05/25
[#41411] Re: [Bug #3339] win32ole test failure — Masaki Suketa <masaki.suketa@...> 2010/05/25

助田です。

[#41412] Re: [Bug #3339] win32ole test failure — "U.Nakamura" <usa@...> 2010/05/25

こんにちは、なかむら(う)です。

[ruby-dev:41399] [trunk:bug] Psych raises an exception with diffrent name class

From: Nobuyoshi Nakada <nobu@...>
Date: 2010-05-24 03:27:29 UTC
List: ruby-dev #41399
なかだです。

以下のように、Fooが指定されているのにメッセージではStruct::Fooが
ないということになっています。

$ ./ruby -v -rpsych -ryaml -e 'p((YAML.load("--- !ruby/object:Foo\nfoo: 1") rescue $!.message))'
ruby 1.9.3dev (2010-05-24 trunk 27985) [i386-darwin9.0]
"undefined class/module Struct::Foo"

元の名前を示すべきではないでしょうか。


diff --git a/ext/psych/lib/psych/visitors/to_ruby.rb b/ext/psych/lib/psych/visitors/to_ruby.rb
index e28ac7b..ffff636 100644
--- a/ext/psych/lib/psych/visitors/to_ruby.rb
+++ b/ext/psych/lib/psych/visitors/to_ruby.rb
@@ -246,13 +246,13 @@ module Psych
 
         begin
           path2class(name)
-        rescue ArgumentError => ex
-          name    = "Struct::#{name}"
+        rescue ArgumentError, NameError => ex
           unless retried
-            retried = true
+            name    = "Struct::#{name}"
+            retried = ex
             retry
           end
-          raise ex
+          raise retried
         end
       end
     end


-- 
--- 僕の前にBugはない。
--- 僕の後ろにBugはできる。
    中田 伸悦

In This Thread

Prev Next