diff options
| author | Martin <gzlist@googlemail.com> | 2011-04-25 00:38:27 +0100 |
|---|---|---|
| committer | Martin <gzlist@googlemail.com> | 2011-04-25 00:38:27 +0100 |
| commit | 4953d515c61733237dc78842f0785ddd3e9d69c5 (patch) | |
| tree | a05f7df4a970d0f105e5431520756a8fdde4ece1 /python | |
| parent | 83ee9fc3528955994c55ba46c1784cbf6d3c3ae8 (diff) | |
| download | subunit-git-4953d515c61733237dc78842f0785ddd3e9d69c5.tar.gz | |
Vary fileno attempt exception type to support Python 3
Diffstat (limited to 'python')
| -rw-r--r-- | python/subunit/__init__.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/python/subunit/__init__.py b/python/subunit/__init__.py index 146d2c1..7e2f141 100644 --- a/python/subunit/__init__.py +++ b/python/subunit/__init__.py @@ -1137,11 +1137,16 @@ def get_default_formatter(): return sys.stdout +if sys.version_info > (3, 0): + from io import UnsupportedOperation as _NoFilenoError +else: + _NoFilenoError = AttributeError + def _make_stream_binary(stream): """Ensure that a stream will be binary safe. See _make_binary_on_windows.""" try: fileno = stream.fileno() - except AttributeError: + except _NoFilenoError: return _make_binary_on_windows(fileno) |
