summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorRobert Collins <robertc@robertcollins.net>2013-02-08 00:33:11 +1300
committerRobert Collins <robertc@robertcollins.net>2013-02-08 00:33:11 +1300
commitc52fb29f1290f4264534d2b46cb048bd07d8e485 (patch)
tree51f3551cde9c726e9905f39c4dcc2517764af1cd /python
parent66e1ef8404b891993c12212576ca08b86fc0517f (diff)
downloadsubunit-git-c52fb29f1290f4264534d2b46cb048bd07d8e485.tar.gz
Release 0.0.10.0.0.10
Diffstat (limited to 'python')
-rw-r--r--python/subunit/__init__.py23
1 files changed, 13 insertions, 10 deletions
diff --git a/python/subunit/__init__.py b/python/subunit/__init__.py
index f870904..77f4a82 100644
--- a/python/subunit/__init__.py
+++ b/python/subunit/__init__.py
@@ -159,7 +159,7 @@ from subunit import chunked, details, iso8601, test_results
# If the releaselevel is 'final', then the tarball will be major.minor.micro.
# Otherwise it is major.minor.micro~$(revno).
-__version__ = (0, 0, 9, 'final', 0)
+__version__ = (0, 0, 10, 'final', 0)
PROGRESS_SET = 0
PROGRESS_CUR = 1
@@ -1301,14 +1301,17 @@ def _make_binary_on_windows(fileno):
def _unwrap_text(stream):
"""Unwrap stream if it is a text stream to get the original buffer."""
if sys.version_info > (3, 0):
+ unicode_type = str
+ else:
+ unicode_type = unicode
+ try:
+ # Read streams
+ if type(stream.read(0)) is unicode_type:
+ return stream.buffer
+ except (_UnsupportedOperation, IOError):
+ # Cannot read from the stream: try via writes
try:
- # Read streams
- if type(stream.read(0)) is str:
- return stream.buffer
- except (_UnsupportedOperation, IOError):
- # Cannot read from the stream: try via writes
- try:
- stream.write(_b(''))
- except TypeError:
- return stream.buffer
+ stream.write(_b(''))
+ except TypeError:
+ return stream.buffer
return stream