Project

General

Profile

Actions

Bug #2697

closed

rubyspec: StringIO#ungetc when passed [char] tries to convert the passed length to an Integer using #to_int ERROR

Added by mame (Yusuke Endoh) over 15 years ago. Updated about 14 years ago.

Status:
Rejected
Assignee:
-
Target version:
-
ruby -v:
ruby 1.9.2dev (2010-01-28 trunk 26458) [x86_64-freebsd8.0]
Backport:
[ruby-dev:40272]

Description

=begin
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
=end

Actions #1

Updated by naruse (Yui NARUSE) over 15 years ago

  • Category set to ext
  • Status changed from Open to Rejected
  • ruby -v set to ruby 1.9.2dev (2010-01-28 trunk 26458) [x86_64-freebsd8.0]

=begin
IO#ungetc も同様の挙動なので、仕様変更でしょう。
=end

Actions

Also available in: Atom PDF

Like0
Like0