diff --git a/django/db/backends/oracle/schema.py b/django/db/backends/oracle/schema.py index 986cd95e75..702b3791d0 100644 --- a/django/db/backends/oracle/schema.py +++ b/django/db/backends/oracle/schema.py @@ -24,8 +24,7 @@ class DatabaseSchemaEditor(BaseDatabaseSchemaEditor): return "'%s'" % value elif isinstance(value, six.string_types): return "'%s'" % six.text_type(value).replace("\'", "\'\'") - elif (isinstance(value, six.memoryview) or - six.PY3 and isinstance(value, bytes)): + elif isinstance(value, six.buffer_types): return "'%s'" % force_text(binascii.hexlify(value)) elif isinstance(value, bool): return "1" if value else "0" diff --git a/django/utils/six.py b/django/utils/six.py index bf94a83000..8c582deaac 100644 --- a/django/utils/six.py +++ b/django/utils/six.py @@ -666,6 +666,7 @@ if PY3: _assertRaisesRegex = "assertRaisesRegex" _assertRegex = "assertRegex" memoryview = memoryview + buffer_types = (bytes, bytearray, memoryview) else: _assertRaisesRegex = "assertRaisesRegexp" _assertRegex = "assertRegexpMatches" @@ -676,6 +677,7 @@ else: memoryview = memoryview else: memoryview = buffer + buffer_types = (bytearray, memoryview) def assertRaisesRegex(self, *args, **kwargs):