diff options
author | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2019-04-19 20:34:20 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-19 20:34:20 +0200 |
commit | a41b09266dcdd01036d59d76fe926fe0386aaade (patch) | |
tree | 773fe7b12ec7629774a8b459d1f2d8002fa02c83 /django/db/backends/mysql/schema.py | |
parent | 12b7956fc3735101fcad597047b80b57efb5048a (diff) | |
download | django-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.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 |