Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pymysql/converters.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,7 @@ def through(x):
float: escape_float,
str: escape_str,
bytes: escape_bytes,
bytearray: escape_bytes,
tuple: escape_sequence,
list: escape_sequence,
set: escape_sequence,
Expand Down
6 changes: 6 additions & 0 deletions pymysql/tests/test_converters.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,3 +103,9 @@ def test_decimal_special_values(self):
ProgrammingError, f"{str(value).lower()} can not be used with MySQL"
):
converters.Decimal2Literal(value, None)


def test_escape_binary_types_in_sequence():
expected = "(_binary X'6162')"
assert converters.escape_item([b"ab"], "utf8") == expected
assert converters.escape_item([bytearray(b"ab")], "utf8") == expected