diff --git a/lib/mysql/connector/cursor_cext.py b/lib/mysql/connector/cursor_cext.py index 64f8c28a..27fe883a 100644 --- a/lib/mysql/connector/cursor_cext.py +++ b/lib/mysql/connector/cursor_cext.py @@ -511,11 +511,14 @@ def fetchmany(self, size=1): if size and self._cnx.unread_result: rows.extend(self._cnx.get_rows(size)[0]) - if size and self._cnx.unread_result: - self._nextrow = self._cnx.get_row() - if self._nextrow and not self._nextrow[0] and \ - not self._cnx.more_results: - self._cnx.free_result() + if size: + if self._cnx.unread_result: + self._nextrow = self._cnx.get_row() + if self._nextrow and not self._nextrow[0] and \ + not self._cnx.more_results: + self._cnx.free_result() + else: + self._nextrow = (None, None) if not rows: self._handle_eof()