-
Notifications
You must be signed in to change notification settings - Fork 38.7k
qa: Close SQLite connection properly #28204
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
Conversation
Connection object used as context manager only commits or rollbacks transactions, so the connection object should be closed manually. Fixes the following error on Windows: ``` PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: ... ```
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ReviewsSee the guideline for information on the review process.
If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update. |
theStack
left a comment
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.
utACK 703b758
Thanks for fixing! Can't reproduce the error locally as I don't have a Windows machine available, but the change looks correct to me and is in line with the Python documentation (https://docs.python.org/3/library/sqlite3.html#sqlite3-connection-context-manager).
|
lgtm ACK 703b758 |
|
Interesting that this isn't caught on Windows in Cirrus CI? https://cirrus-ci.com/task/5010562627665920?logs=functional_tests#L210 |
The reason of that is the Line 188 in 2fa60f0
|
703b758 qa: Close SQLite connection properly (Hennadii Stepanov) Pull request description: This PR is a follow-up for bitcoin#26462 that introduced a bug on Windows: ``` >test\functional\wallet_descriptor.py ... PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: ... ``` From `sqlite3` Python module [docs](https://docs.python.org/3/library/sqlite3.html#how-to-use-the-connection-context-manager): > `Connection` object used as context manager only commits or rollbacks transactions, so the connection object should be closed manually. ACKs for top commit: MarcoFalke: lgtm ACK 703b758 theStack: utACK 703b758 Tree-SHA512: 35b1403507be06d1fc04e7e07ff56af5bcfe5013024671f0c1d9f3c41aacc4c777bcc6376ce82d720394e27450415d50ff5d5834ed388ec3f21503f86f1a42a5
This PR is a follow-up for #26462 that introduced a bug on Windows:
From
sqlite3Python module docs: