diff options
Diffstat (limited to 'django/db/backends/mysql/schema.py')
-rw-r--r-- | django/db/backends/mysql/schema.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/django/db/backends/mysql/schema.py b/django/db/backends/mysql/schema.py index 172e9b9ac8..666aa292e8 100644 --- a/django/db/backends/mysql/schema.py +++ b/django/db/backends/mysql/schema.py @@ -31,8 +31,9 @@ class DatabaseSchemaEditor(BaseDatabaseSchemaEditor): def quote_value(self, value): self.connection.ensure_connection() + # MySQLdb escapes to string, PyMySQL to bytes. quoted = self.connection.connection.escape(value, self.connection.connection.encoders) - if isinstance(value, str): + if isinstance(value, str) and isinstance(quoted, bytes): quoted = quoted.decode() return quoted |