summaryrefslogtreecommitdiff
path: root/django/db/backends/mysql/schema.py
diff options
context:
space:
mode:
authorMariusz Felisiak <felisiak.mariusz@gmail.com>2019-04-19 20:34:20 +0200
committerGitHub <noreply@github.com>2019-04-19 20:34:20 +0200
commita41b09266dcdd01036d59d76fe926fe0386aaade (patch)
tree773fe7b12ec7629774a8b459d1f2d8002fa02c83 /django/db/backends/mysql/schema.py
parent12b7956fc3735101fcad597047b80b57efb5048a (diff)
downloaddjango-a41b09266dcdd01036d59d76fe926fe0386aaade.tar.gz
Fixed #30380 -- Handled bytes in MySQL backend for PyMySQL support.
This commit partly reverts efd8a82e268a82b3ad0be77bd5b4548c30bcb4d7.
Diffstat (limited to 'django/db/backends/mysql/schema.py')
-rw-r--r--django/db/backends/mysql/schema.py3
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