> There are three calls of pysqlite_statement_reset() in _pysqlite_query_execute()
Yes, but only two before the cache is queried.
> So additional call of pysqlite_statement_reset() does not harm.
That's true, but removing redundant code makes it easier to read and maintain, IMO.
> On other hand removing it can introduce race condition.
How?
> Maybe the code could be rewritten in more explicit way and call pysqlite_statement_reset() only when it is necessary
Most of _pysqlite_query_execute() could be rewritten in order to make the code clearer. An alternative is to clean it up part by part.