We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 634fefd commit ecabbf4Copy full SHA for ecabbf4
1 file changed
pycatfile.py
@@ -192,10 +192,17 @@ def _wrap(stream):
192
FileNotFoundError = IOError
193
194
try:
195
- UnsupportedOperation = io.UnsupportedOperation # Py3
196
-except AttributeError:
197
- class UnsupportedOperation(IOError): # Py2 fallback
198
- pass
+ # Works on Py3 and Py2.7
+ from io import UnsupportedOperation
+except Exception:
+ # Mimic CPython: subclass both OSError/IOError and ValueError
199
+ try:
200
+ class UnsupportedOperation(IOError, ValueError):
201
+ pass
202
+ except Exception:
203
+ # Ultra-old fallback if multiple inheritance caused issues on exotic runtimes
204
+ class UnsupportedOperation(IOError):
205
206
207
# RAR file support
208
rarfile_support = False
0 commit comments