Project

General

Profile

Bug #9865

frozen IO object causes RuntimeError with inspect and fileno

Added by akr (Akira Tanaka) almost 5 years ago. Updated over 4 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
-
ruby -v:
ruby 2.2.0dev (2014-05-27 trunk 46150) [x86_64-linux]
[ruby-dev:48241]

Description

IO object を freeze すると、inspect や fileno が RuntimeError になるんですが、
これはよろしくないんじゃないかと思います。

% ./ruby -e 'f = open("."); f.freeze; p f'       
-e:1:in `inspect': can't modify frozen File (RuntimeError)
    from -e:1:in `p'
    from -e:1:in `<main>'
% ./ruby -e 'f = open("."); f.freeze; p f.fileno'
-e:1:in `fileno': can't modify frozen File (RuntimeError)
    from -e:1:in `<main>'
% ./ruby -v
ruby 2.2.0dev (2014-05-27 trunk 46150) [x86_64-linux]

あるいは、なにか理由がありましたっけ?

Associated revisions

Revision 2e5d6985
Added by nobu (Nobuyoshi Nakada) almost 5 years ago

io.c: no error on frozen IO

  • io.c (rb_io_fileno, rb_io_inspect): non-modification does not error on frozen IO. [ruby-dev:48241] [Bug #9865]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46151 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Revision 46151
Added by nobu (Nobuyoshi Nakada) almost 5 years ago

io.c: no error on frozen IO

  • io.c (rb_io_fileno, rb_io_inspect): non-modification does not error on frozen IO. [ruby-dev:48241] [Bug #9865]

Revision 46151
Added by nobu (Nobuyoshi Nakada) almost 5 years ago

io.c: no error on frozen IO

  • io.c (rb_io_fileno, rb_io_inspect): non-modification does not error on frozen IO. [ruby-dev:48241] [Bug #9865]

Revision 46151
Added by nobu (Nobuyoshi Nakada) almost 5 years ago

io.c: no error on frozen IO

  • io.c (rb_io_fileno, rb_io_inspect): non-modification does not error on frozen IO. [ruby-dev:48241] [Bug #9865]

Revision 46151
Added by nobu (Nobuyoshi Nakada) almost 5 years ago

io.c: no error on frozen IO

  • io.c (rb_io_fileno, rb_io_inspect): non-modification does not error on frozen IO. [ruby-dev:48241] [Bug #9865]

Revision 46151
Added by nobu (Nobuyoshi Nakada) almost 5 years ago

io.c: no error on frozen IO

  • io.c (rb_io_fileno, rb_io_inspect): non-modification does not error on frozen IO. [ruby-dev:48241] [Bug #9865]

Revision 46151
Added by nobu (Nobuyoshi Nakada) almost 5 years ago

io.c: no error on frozen IO

  • io.c (rb_io_fileno, rb_io_inspect): non-modification does not error on frozen IO. [ruby-dev:48241] [Bug #9865]

Revision 5a5ac314
Added by nagachika (Tomoyuki Chikanaga) over 4 years ago

merge revision(s) r46151,r46165: [Backport #9865]

* io.c (rb_io_fileno, rb_io_inspect): non-modification does not
  error on frozen IO.  [ruby-dev:48241] [Bug #9865]

* io.c (rb_io_autoclose_p): Don't raise on frozen IO.

* test/lib/minitest/unit.rb: IO#autoclose? may raise IOError.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@47140 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Revision 47140
Added by nagachika (Tomoyuki Chikanaga) over 4 years ago

merge revision(s) r46151,r46165: [Backport #9865]

* io.c (rb_io_fileno, rb_io_inspect): non-modification does not
  error on frozen IO.  [ruby-dev:48241] [Bug #9865]

* io.c (rb_io_autoclose_p): Don't raise on frozen IO.

* test/lib/minitest/unit.rb: IO#autoclose? may raise IOError.

Revision 47264c4e
Added by usa (Usaku NAKAMURA) over 4 years ago

merge revision(s) 46151,46165: [Backport #9865]

* io.c (rb_io_fileno, rb_io_inspect): non-modification does not
  error on frozen IO.  [ruby-dev:48241] [Bug #9865]

* io.c (rb_io_autoclose_p): Don't raise on frozen IO.

* test/lib/minitest/unit.rb: IO#autoclose? may raise IOError.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@47368 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Revision 47368
Added by usa (Usaku NAKAMURA) over 4 years ago

merge revision(s) 46151,46165: [Backport #9865]

* io.c (rb_io_fileno, rb_io_inspect): non-modification does not
  error on frozen IO.  [ruby-dev:48241] [Bug #9865]

* io.c (rb_io_autoclose_p): Don't raise on frozen IO.

* test/lib/minitest/unit.rb: IO#autoclose? may raise IOError.

History

Updated by nobu (Nobuyoshi Nakada) almost 5 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

Applied in changeset r46151.


io.c: no error on frozen IO

  • io.c (rb_io_fileno, rb_io_inspect): non-modification does not error on frozen IO. [ruby-dev:48241] [Bug #9865]

Updated by usa (Usaku NAKAMURA) almost 5 years ago

  • Backport changed from 2.0.0: UNKNOWN, 2.1: UNKNOWN to 2.0.0: REQUIRED, 2.1: REQUIRED

Updated by nagachika (Tomoyuki Chikanaga) over 4 years ago

  • Backport changed from 2.0.0: REQUIRED, 2.1: REQUIRED to 2.0.0: REQUIRED, 2.1: DONE

r46151 and r46165 (partially) were backported into ruby_2_1 branch at r47140.

Updated by usa (Usaku NAKAMURA) over 4 years ago

  • Backport changed from 2.0.0: REQUIRED, 2.1: DONE to 2.0.0: DONE, 2.1: DONE

backported into ruby_2_0_0 at r37368.

note: respect existing security checks on this version.

Also available in: Atom PDF