Skip to content

Commit

Permalink
Merge pull request #66 from michalc/refactor/simplify-finalize
Browse files Browse the repository at this point in the history
refactor: remove dead code to simplify finalization
  • Loading branch information
michalc authored Aug 1, 2023
2 parents 0af9bfc + 39fece7 commit b1a575b
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions sqlite_s3_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,11 +295,7 @@ def get_pp_stmt(statement):
raise Exception('Attempting to use finalized statement') from None

def finalize(statement):
# In case there are errors, don't attempt to re-finalize the same statement
try:
pp_stmt = statements.pop(statement)
except KeyError:
return
pp_stmt = statements.pop(statement)

try:
run_with_db(db, libsqlite3.sqlite3_finalize, pp_stmt)
Expand All @@ -323,11 +319,7 @@ def get_pp_stmts(sql):
statements[statement] = pp_stmt
yield partial(get_pp_stmt, statement), partial(finalize, statement)

try:
yield get_pp_stmts
finally:
for statement in statements.copy().keys():
finalize(statement)
yield get_pp_stmts

def rows(get_pp_stmt, columns):
while True:
Expand Down

0 comments on commit b1a575b

Please sign in to comment.