Skip to content

fetchone() should return None if no row #4

jimslack opened this Issue Jun 22, 2011 · 1 comment

2 participants


PEP 249 says that fetchone() should return None when no more data is available. The current code does not do that. Also, the second statement will never execute:

def fetchone(self):
    return self.rows[self.cur_row]
    self.cur_row += 1

Here is my suggested update:

def fetchone(self):
    if self.cur_row < len(self.rows):
        row = self.rows[self.cur_row]
        self.cur_row += 1
        return row
        return None
@nakagami nakagami closed this Jun 23, 2011

Thanks merge as commit 31c4737

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.