Binary initializer should accept bytearrays (closes #5084075)
Recent versions of pyodbc return bytearray objects for binary data.
--- a/__init__.py Fri Mar 13 14:47:35 2015 +0100
+++ b/__init__.py Tue Mar 17 09:19:06 2015 +0100
@@ -71,12 +71,12 @@
class Binary(StringIO):
"""customize StringIO to make sure we don't use unicode"""
def __init__(self, buf=''):
- assert isinstance(buf, (str, buffer)), \
+ assert isinstance(buf, (str, buffer, bytearray)), \
"Binary objects must use raw strings, not %s" % buf.__class__
StringIO.__init__(self, buf)
def write(self, data):
- assert isinstance(data, (str, buffer)), \
+ assert isinstance(data, (str, buffer, bytearray)), \
"Binary objects must use raw strings, not %s" % data.__class__
StringIO.write(self, data)