New submission from Antoine Pitrou <pit...@free.fr>: Some of them currently raise IOError. Fortunately, UnsupportedOperation inherits from IOError, which means compatibility can be preserved.
Contrast: >>> open("LICENSE").write("bar") Traceback (most recent call last): File "<stdin>", line 1, in <module> IOError: not writable With: >>> open("LICENSE", "rb").write(b"") Traceback (most recent call last): File "<stdin>", line 1, in <module> io.UnsupportedOperation: write Or: >>> io.StringIO().fileno() Traceback (most recent call last): File "<stdin>", line 1, in <module> io.UnsupportedOperation: fileno Or, unfortunately: >>> open("LICENSE", "rb", buffering=0).write(b"") Traceback (most recent call last): File "<stdin>", line 1, in <module> ValueError: File not open for writing ---------- components: IO, Library (Lib) keywords: easy messages: 110648 nosy: amaury.forgeotdarc, benjamin.peterson, haypo, pitrou priority: normal severity: normal status: open title: Unsupported IO operations should raise UnsupportedOperation type: behavior versions: Python 3.2 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue9293> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com