Add a Django patch to work around a mysqlclient incompatibility.

Review Request #11898 — Created Jan. 2, 2022 and submitted — Latest diff uploaded

chipx86
Django Evolution
release-2.x
django-evolution

Django, up through 1.11, made an assumption that mysqlclient's
database connection class had bytes in a mapping of internal data type
converters. This assumption worked in Python 2.7, since bytes and
str were the same thing, but it broke on Python 3. The mysqlclient
developers temporarily added compatibility for this, but have recently
removed that as of mysqlclient 2.1, since Django 2.0+ doesn't exhibit
this problem.

This change adds a patch to work around that problem. It pre-populates
the needed bytes mapping in the conversion map that Django sets up and
passes to mysqlclient. Django's improper logic will still kick in, but
it will no longer fail on newer versions of mysqlclient without that
workaround.

Tested MySQL support on Python 3 on Django 1.6 through 2.0, with
mysqlclient 1.4.6, 2.0, and 2.1.

Commits

Files

Loading...