From: Yusuke ENDOH Date: 2010-01-31T19:33:23+09:00 Subject: [ruby-dev:40272] [Bug:trunk] rubyspec: StringIO#ungetc when passed [char] tries to convert the passed length to an Integer using #to_int ERROR stringio のメンテナのなかださん、もしくは成瀬さん 遠藤です。 to_int を実装したオブジェクトを StringIO#ungetc に与えた時の挙動が 1.8 と 1.9 で違います。 # 1.8 では普通に受け入れる $ ruby18 -rstringio -e ' o = Object.new def o.to_int; ?A.ord; end StringIO.new.ungetc(o) ' # 1.9 では例外 $ ruby19 -rstringio -e ' o = Object.new def o.to_int; ?A.ord; end StringIO.new.ungetc(o) ' -e:4:in `ungetc': can't convert Object into String (TypeError) from -e:4:in `
' M17N 対応の影響だと思いますが、これは 1.9 からの仕様変更としますか? -- Yusuke ENDOH