[issue43350] [sqlite3] Active statements are reset twice in _pysqlite_query_execute()

Serhiy Storchaka report at bugs.python.org
Mon Mar 1 07:15:06 EST 2021


Serhiy Storchaka <storchaka+cpython at gmail.com> added the comment:

There are three calls of pysqlite_statement_reset() in _pysqlite_query_execute(). And all three of them can be called with the same statement object. But repeated calls are no-ops because pysqlite_statement_reset() clears flag in_use and calls sqlite3_reset() only if it was set before. So additional call of pysqlite_statement_reset() does not harm. You can call it as many times as you want. On other hand removing it can introduce race condition.

Maybe the code could be rewritten in more explicit way and call pysqlite_statement_reset() only when it is necessary, but for now I don't think that just removing one call will make the code better.

----------

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


More information about the Python-bugs-list mailing list