[issue43290] [sqlite3] remove legacy code from pysqlite_step

Erlend Egeberg Aasland report at bugs.python.org
Thu Feb 25 08:22:09 EST 2021


Erlend Egeberg Aasland <erlend.aasland at innova.no> added the comment:

msg387668 was a little bit hasty. I'll try again:

Dong-hee Na:
> Hmm by the way the current implementation returns SQLITE_OK if the statement is NULL, but it looks like return SQLITE_MISUSE if we apply this patch.
> Does it not cause any behavior regression? if so we should add news also.

No, behaviour still stays the same; no regressions introduced. The bug is triggered by executing an empty statement. This will pass an empty statement to pysqlite_step() in line 519 of Modules/_sqlite/cursor.c. Earlier, this returned SQLITE_OK. sqlite3_column_count(NULL) returns 0, so we slide through the rest of the loop without much happening. Now, pysqlite_step() returns SQLITE_MISUSE, which only results in the statement being reset in line 529, and the error cleared in line 530. Then we bail out of the loop.

So, the current comment is correct, the SQLite changelog was correct, the workaround and old comment was wrong.

I'm done :)

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue43290>
_______________________________________


More information about the Python-bugs-list mailing list