Skip to content

Commit 88ca33c

Browse files
committed
Add frozenset to escape_sequence types
1 parent 776b9e6 commit 88ca33c

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

pymysql/converters.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,7 @@ def convert_characters(connection, field, data):
355355
tuple: escape_sequence,
356356
list: escape_sequence,
357357
set: escape_sequence,
358+
frozenset: escape_sequence,
358359
dict: escape_dict,
359360
bytearray: escape_bytes,
360361
type(None): escape_None,

pymysql/tests/test_basic.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,15 @@ def test_datatypes(self):
4242

4343
c.execute("delete from test_datatypes")
4444

45-
# check sequence type
46-
c.execute("insert into test_datatypes (i, l) values (2,4), (6,8), (10,12)")
47-
c.execute("select l from test_datatypes where i in %s order by i", ((2,6),))
48-
r = c.fetchall()
49-
self.assertEqual(((4,),(8,)), r)
45+
# check sequences type
46+
for seq_type in (tuple, list, set, frozenset):
47+
c.execute("insert into test_datatypes (i, l) values (2,4), (6,8), (10,12)")
48+
seq = seq_type([2,6])
49+
c.execute("select l from test_datatypes where i in %s order by i", (seq,))
50+
r = c.fetchall()
51+
self.assertEqual(((4,),(8,)), r)
52+
c.execute("delete from test_datatypes")
53+
5054
finally:
5155
c.execute("drop table test_datatypes")
5256

0 commit comments

Comments
 (0)