Skip to content

Commit 68ded79

Browse files
committed
Merge branch 'BUG20987205' into develop
2 parents 03aa47e + fbe841d commit 68ded79

File tree

11 files changed

+793
-463
lines changed

11 files changed

+793
-463
lines changed

lib/mysql/connector/cursor.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -598,9 +598,11 @@ def executemany(self, operation, seq_params):
598598
return None
599599
self._connection.handle_unread_result()
600600

601-
if not isinstance(seq_params, (list, tuple)):
601+
try:
602+
_ = iter(seq_params)
603+
except TypeError:
602604
raise errors.ProgrammingError(
603-
"Parameters for query must be list or tuple.")
605+
"Parameters for query must be an Iterable.")
604606

605607
# Optimize INSERTs by batching them
606608
if re.match(RE_SQL_INSERT_STMT, operation):
@@ -859,9 +861,11 @@ def statement(self):
859861
statements were executed, the current statement in the iterator
860862
will be returned.
861863
"""
864+
if self._executed is None:
865+
return None
862866
try:
863-
return self._executed.strip().decode('utf8')
864-
except AttributeError:
867+
return self._executed.strip().decode('utf-8')
868+
except (AttributeError, UnicodeDecodeError) as err:
865869
return self._executed.strip()
866870

867871
@property

0 commit comments

Comments
 (0)