diff options
| author | Martin <gzlist@googlemail.com> | 2011-04-25 00:37:52 +0100 |
|---|---|---|
| committer | Martin <gzlist@googlemail.com> | 2011-04-25 00:37:52 +0100 |
| commit | b5dbe188b005c8f1100ba9c6cb286612e01ee2cb (patch) | |
| tree | 4b990c0efa8eb2c51c7ffbf8a0abfe6be517b188 /python/subunit/__init__.py | |
| parent | 97ecb48c055230acffb0b06b559f78679c988883 (diff) | |
| download | subunit-b5dbe188b005c8f1100ba9c6cb286612e01ee2cb.tar.gz | |
Use try/except rather than getattr to test for fileno _make_stream_binary
Diffstat (limited to 'python/subunit/__init__.py')
| -rw-r--r-- | python/subunit/__init__.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/python/subunit/__init__.py b/python/subunit/__init__.py index 5387cae..146d2c1 100644 --- a/python/subunit/__init__.py +++ b/python/subunit/__init__.py @@ -1139,9 +1139,11 @@ def get_default_formatter(): def _make_stream_binary(stream): """Ensure that a stream will be binary safe. See _make_binary_on_windows.""" - if getattr(stream, 'fileno', None) is not None: - print (stream, type(stream)) - _make_binary_on_windows(stream.fileno()) + try: + fileno = stream.fileno() + except AttributeError: + return + _make_binary_on_windows(fileno) def _make_binary_on_windows(fileno): """Win32 mangles \r\n to \n and that breaks streams. See bug lp:505078.""" |
