[issue4841] io's close() not handling errors correctly
report at bugs.python.org
Wed Jan 7 14:11:07 CET 2009
Ulrich Eckhardt <eckhardt at satorlaser.com> added the comment:
>> 4. I wonder if internal_close() should reset only the 'fd' field
>> or if it should also reset 'readable', 'writable', 'seekable'
> seekable(), readable() and writable() raise an error if the file
> is closed. I think it's fine to leave the internal attributes
That's not what I'm concerned about. What I'm concerned about is this:
f = _FileIO(open("some text file"))
The cached value whether the file was seekable survives the __init__
call but is actually wrong then. Of course, one could also reset the
value in __init__. Whether the file is readable or writable is
different, since those values are supplied via the mode string and the
code by the user and not determined automatically.
I think that I just found another buglet, too: when supplying a file
descriptor, dircheck() isn't actually called. os.open() under 2.5 on
Debian/Linux at least allows opening '.', trunk under MS Windows fails
with "permission denied".
Python tracker <report at bugs.python.org>
More information about the Python-bugs-list