-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Bump libsqlite3-sys from 0.28 to 0.36 #6472
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Pl 10000 ease reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: RustPython/RustPython
Length of output: 2855
🏁 Script executed:
Repository: RustPython/RustPython
Length of output: 3836
🏁 Script executed:
Repository: RustPython/RustPython
Length of output: 4200
🏁 Script executed:
Repository: RustPython/RustPython
Length of output: 2293
Ensure all cursors are closed before closing the connection, or use sqlite3_close_v2 to defer close until statements finalize.
The change from
sqlite3_close_v2tosqlite3_closeintroduces a resource leak risk:sqlite3_closereturnsSQLITE_BUSYif unfinalized statements exist and fails silently in DropConnection.close()callsdrop_db()immediately while activeCursorobjects may still hold prepared statementsCursoris dropped, which may happen after the connection is droppedEither:
Connection.close()is calledsqlite3_close_v2for more resilient cleanup semanticsdrop_db()before closing the connectionThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ever0de Is this looking a correct review?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I created comprehensive tests comparing CPython's behavior with RustPython when closing connections with active cursors. Both implementations behave identically - they successfully close the connection even when cursors remain active, and subsequent cursor operations properly raise
ProgrammingError.Investigation of sqlite3_close vs sqlite3_close_v2:
While CPython does use
sqlite3_close_v2()for its deferred cleanup semantics, libsqlite3-sys intentionally removedsqlite3_close_v2from its API in version 0.29.0 (rusqlite/rusqlite@4390720).The commit message explicitly states:
The rationale is that
sqlite3_close_v2is specifically designed for garbage-collected languages where destructor order is non-deterministic. In Rust, with its deterministic RAII-based resource management, the v2 variant is unnecessary. The library maintainers deliberately chose to expose onlysqlite3_closeas the canonical close function for Rust applications.This means the use of
sqlite3_close()in this PR is not only necessary due to API constraints but also aligns with rusqlite's design philosophy.Why it works safely:
Our implementation is safe because:
drop_db()method takes ownership via.take(), ensuring clean Drop trait executionSqliteStatementis droppedThe current implementation matches CPython's observable behavior even though the internal mechanism differs due to library design decisions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for confirming!