From 44af2b1eebd438178681fd3a1af38d9def2f93e9 Mon Sep 17 00:00:00 2001 From: Federico Ressi Date: Fri, 27 Sep 2019 12:44:13 +0200 Subject: Check written bytes are not None before summing them to offset Because purely written streams could return None instead of written bytes, we cannot sum them to offset integer. On such case let assume data has been written all at once. This fixes LaunchPad [#1845631](https://bugs.launchpad.net/subunit/+bug/1845631) --- python/subunit/v2.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'python') diff --git a/python/subunit/v2.py b/python/subunit/v2.py index 254617c..7f4842e 100644 --- a/python/subunit/v2.py +++ b/python/subunit/v2.py @@ -223,6 +223,8 @@ class StreamResultToBytes(object): offset = 0 while offset < datalen: written = self.output_stream.write(view[offset:]) + if written is None: + break offset += written else: self.output_stream.write(data) -- cgit v1.2.1