petehunt/PyMySQL — Issue #101: Cursor.fetchmany checks "if self._rows is None" too late
Author: vitaly-krugl
Created: 2012-02-29 21:55:53+00:00
State: open

>>>
In [10]: pymysql.VERSION
Out[10]: (0, 4, None)

In [7]: pymysql.version_info
Out[7]: (1, 2, 2, 'final', 0)
<<<

This appears to be same as in latest trunk:

fetchmany first accesses it as a sequence (result = self._rows[self.rownumber:end]), and only afterwards (too late) checks "if self._rows is None":

def fetchmany(self, size=None):
''' Fetch several rows '''
self._check_executed()
end = self.rownumber + (size or self.arraysize)
result = self._rows[self.rownumber:end]
if self._rows is None:
return None
self.rownumber = min(end, len(self._rows))
return result