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 | 3b8a7992f73fce05f7cdfe0ecfbf57561eb91d54 (patch) | |
| tree | a05f7df4a970d0f105e5431520756a8fdde4ece1 /python/subunit | |
| parent | b5dbe188b005c8f1100ba9c6cb286612e01ee2cb (diff) | |
| download | subunit-3b8a7992f73fce05f7cdfe0ecfbf57561eb91d54.tar.gz | |
Vary fileno attempt exception type to support Python 3
Diffstat (limited to 'python/subunit')
| -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) |
