Project

General

Profile

Actions

Bug #9865

closed

frozen IO object causes RuntimeError with inspect and fileno

Added by akr (Akira Tanaka) almost 8 years ago. Updated over 7 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]

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

Actions

Also available in: Atom PDF