Switch use of cStringIO.StringIO to io.BytesIO

This commit switches all our uses of cStringIO.StringIO to io.BytesIO.
The StringIO class is the wrong class to use for this, especially
considering that subunit v2 is binary and not a string. This commit
fixes it so we're using the proper type.

Change-Id: I5d21f7ca2f40cbd5c2659f6cee1570ebe2d4a983
This commit is contained in:
Matthew Treinish 2016-03-01 19:59:30 -05:00
parent e12fc216ed
commit ad3cc21c67
No known key found for this signature in database
GPG Key ID: FD12A0F214C9E177
1 changed files with 4 additions and 4 deletions

View File

@ -15,10 +15,10 @@
# under the License.
import argparse
import cStringIO
import daemon
import gear
import gzip
import io
import json
import logging
import os
@ -121,14 +121,14 @@ class SubunitRetriever(threading.Thread):
return None
if gzipped:
logging.debug("Decompressing gzipped source file.")
raw_strIO = cStringIO.StringIO(raw_buf)
raw_strIO = io.BytesIO(raw_buf)
f = gzip.GzipFile(fileobj=raw_strIO)
buf = cStringIO.StringIO(f.read())
buf = io.BytesIO(f.read())
raw_strIO.close()
f.close()
else:
logging.debug("Decoding source file.")
buf = cStringIO.StringIO(raw_buf)
buf = io.BytesIO(raw_buf)
return buf
def _get_subunit_data(self, source_url, retry):