Another try to fix JSON issues.

pull/5879/head
Khushboo Vashi 2023-02-20 11:21:32 +05:30 committed by GitHub
parent aeb4867bdf
commit b9cbf08b51
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 1 deletions

View File

@ -26,7 +26,8 @@ class DataTypeJSONEncoder(json.JSONEncoder):
return (datetime.datetime.min + obj).time().isoformat()
if isinstance(obj, decimal.Decimal):
return float(obj)
if isinstance(obj, bytes):
return obj.decode('utf-8')
try:
retval = json.JSONEncoder.default(self, obj)
except TypeError:

View File

@ -1987,6 +1987,8 @@ Failed to reset the connection to the server due to following error:
if parameters:
mogrified_sql = cursor.mogrify(query, parameters)
if isinstance(mogrified_sql, bytes):
mogrified_sql = mogrified_sql.decode(self.python_encoding)
return mogrified_sql
else:
return query