[issue9572] IOError or OSError in test_multiprocessing

Florent Xicluna report at bugs.python.org
Thu Aug 26 09:39:55 CEST 2010


Florent Xicluna <florent.xicluna at gmail.com> added the comment:

Łukasz,

_closing is not necessary on FileIO instances. The class already declares an __exit__ method which takes care of closing file.

>>> import io
>>> f = io.FileIO('/tmp/test_closing', 'wb')
>>> f.closed
False

>>> f.__exit__()
>>> f.closed
True

Since both IOError and OSError are direct subclasses of EnvironmentError, we can use this in the except clause.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue9572>
_______________________________________


More information about the Python-bugs-list mailing list