[New-bugs-announce] [issue44958] [sqlite3] only reset statements when needed

Erlend E. Aasland report at bugs.python.org
Thu Aug 19 16:05:09 EDT 2021


New submission from Erlend E. Aasland <erlend.aasland at innova.no>:

Ref. Serhiy's msg387858 in bpo-43350:
"Maybe the code could be rewritten in more explicit way and call pysqlite_statement_reset() only when it is necessary [...]"

Currently, we try to reset statements in all "statement exit" routes. IMO, it would be cleaner to just reset statements when we really need to:
1. before the first sqlite3_step()
2. at cursor exit, if there's an active statement
(3. in pysqlite_do_all_statements() ... see bpo-44092)

This will make the code easier to follow, and it will minimise the number of resets. The current patch is pretty small: 7 insertions(+), 33 deletions(-)

Pro:
- less lines of code, less maintenance
- cleaner exit paths
- optimise SQLite API usage
Con:
- code churn


If this is accepted, PR 25984 of bpo-44073 will be easier to land and review :)

----------
components: Extension Modules
messages: 399931
nosy: berker.peksag, erlendaasland, pablogsal, serhiy.storchaka
priority: normal
severity: normal
status: open
title: [sqlite3] only reset statements when needed

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


More information about the New-bugs-announce mailing list