Issue #9865 has been updated by Nobuyoshi Nakada.

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]

----------------------------------------
Bug #9865: frozen IO object causes RuntimeError with inspect and fileno
https://bugs.ruby-lang.org/issues/9865#change-46879

* Author: Akira Tanaka
* Status: Closed
* Priority: Normal
* Assignee: 
* Category: 
* Target version: 
* ruby -v: ruby 2.2.0dev (2014-05-27 trunk 46150) [x86_64-linux]
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN
----------------------------------------
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]
```

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




-- 
https://bugs.ruby-lang.org/