We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c139119 commit 1cc9494Copy full SHA for 1cc9494
pymysql/converters.py
@@ -81,7 +81,7 @@ def escape_string(value, mapping=None):
81
"""
82
if isinstance(value, unicode):
83
return escape_unicode(value)
84
- assert isinstance(value, bytes)
+ assert isinstance(value, (bytes, bytearray))
85
value = value.replace('\\', '\\\\')
86
value = value.replace('\0', '\\0')
87
value = value.replace('\n', '\\n')
@@ -93,7 +93,7 @@ def escape_string(value, mapping=None):
93
94
def escape_bytes(value, mapping=None):
95
assert isinstance(value, (bytes, bytearray))
96
- return b"_binary'%s'" % value
+ return b"_binary'%s'" % escape_string(value)
97
else:
98
escape_string = _escape_unicode
99
0 commit comments