Tweak Python3 support to help testrepository get 3-ready.
authorRobert Collins <robertc@robertcollins.net>
Sun, 27 Jan 2013 00:55:33 +0000 (13:55 +1300)
committerRobert Collins <robertc@robertcollins.net>
Sun, 27 Jan 2013 00:55:33 +0000 (13:55 +1300)
NEWS
python/subunit/__init__.py

diff --git a/NEWS b/NEWS
index 081dc5d..93c87cc 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,16 @@ subunit release notes
 NEXT (In development)
 ---------------------
 
+BUG FIXES
+~~~~~~~~~
+
+* UnsupportedOperation is available in the Python2.6 io library, so ask
+  forgiveness rather than permission for obtaining it. (Robert Collins)
+
+* Streams with no fileno() attribute are now supported, but they are not
+  checked for being in binary mode: be sure to take care of that if using
+  the library yourself. (Robert Collins)
+
 0.0.9
 -----
 
index 42dcf29..dfc5e94 100644 (file)
@@ -121,9 +121,9 @@ import re
 import subprocess
 import sys
 import unittest
-if sys.version_info > (3, 0):
+try:
     from io import UnsupportedOperation as _UnsupportedOperation
-else:
+except ImportError:
     _UnsupportedOperation = AttributeError
 
 
@@ -1285,7 +1285,7 @@ def _make_stream_binary(stream):
     """
     try:
         fileno = stream.fileno()
-    except _UnsupportedOperation:
+    except (_UnsupportedOperation, AttributeError):
         pass
     else:
         _make_binary_on_windows(fileno)