Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-105539: Emit ResourceWarning if sqlite3 database is not closed explicitly#108015

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged

Conversation

erlend-aasland
Copy link
Contributor

@erlend-aaslanderlend-aasland commentedAug 16, 2023
edited by github-actionsbot
Loading

@erlend-aasland
Copy link
ContributorAuthor

erlend-aasland commentedAug 16, 2023
edited
Loading

@vstinner: with this PR, sqlite3 emits a ResourceWarning ifclose() was not called explicitly on asqlite3.Connection object before it is deleted. I did not (yet) add a resource warning for the case where close fails (future enhancement).

As you can see from the test changes, we've been pretty lax with resource handling in the sqlite3 test suite 😆

UPDATE: Tests updated ingh-108017

vstinner

This comment was marked as outdated.

@erlend-aasland

This comment was marked as outdated.

@erlend-aasland
Copy link
ContributorAuthor

cc.@felixxm

@erlend-aasland
Copy link
ContributorAuthor

cc.@simonw

Copy link
Member

@vstinnervstinner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

LGTM. This change does what it says. There is room for enhancement, but it can be addressed separately (@erlend-aasland already creates issues to track remaining points).

erlend-aasland reacted with hooray emoji
@erlend-aasland
Copy link
ContributorAuthor

Thanks for the review, Victor! I asked about#108015 (comment) on the core dev Discord. If it is an issue, we can fix it later.

@erlend-aasland
Copy link
ContributorAuthor

I'll wait with merging until I've heard from@simonw and@felixxm, in case they've got opinions about this.

@erlend-aasland
Copy link
ContributorAuthor

Note: I intend to add ResourceWarnings in casesqlite3_close*() fails as well, but I will do that in a follow-up PR. Currently, the sqlite3 moduleasserts thatsqlite3_close*() did not fail, which is not optimal.

@felixxm
Copy link
Contributor

I'll wait with merging until I've heard from@simonw and@felixxm, in case they've got opinions about this.

Thanks for pinging me. I'm going to check it out next week, after my holidays 🏖️

erlend-aasland reacted with heart emoji

@felixxm
Copy link
Contributor

I'll wait with merging until I've heard from@simonw and@felixxm, in case they've got opinions about this.

Thanks for pinging me. I'm going to check it out next week, after my holidays 🏖️

This change doesn't break anything important in Django 👍 (at the first glance). I've started fixingResourceWarnings in our tests, check outdjango/django#17178.

erlend-aasland reacted with rocket emoji

@erlend-aasland
Copy link
ContributorAuthor

This change doesn't break anything important in Django 👍 (at the first glance). I've started fixingResourceWarnings in our tests, check outdjango/django#17178.

Great, thanks for chiming in.

@erlend-aaslanderlend-aasland merged commit1a1bfc2 intopython:mainAug 22, 2023
@erlend-aaslanderlend-aasland deleted the sqlite/resource-warning branchAugust 22, 2023 11:10
@erlend-aasland
Copy link
ContributorAuthor

Thanks for the reviews!

@vstinner
Copy link
Member

Congrats :-) IMO it's a nice enhancement.

erlend-aasland reacted with hooray emoji

felixxm added a commit to felixxm/django that referenced this pull requestAug 23, 2023
- backends.sqlite.tests.ThreadSharing.test_database_sharing_in_threads- backends.tests.ThreadTests.test_default_connection_thread_local:    on SQLite, close() doesn't explicitly close in-memory connections.- servers.tests.LiveServerInMemoryDatabaseLockTest- test_runner.tests.SQLiteInMemoryTestDbs.test_transaction_supportCheck outpython/cpython#108015.
felixxm added a commit to django/django that referenced this pull requestAug 23, 2023
- backends.sqlite.tests.ThreadSharing.test_database_sharing_in_threads- backends.tests.ThreadTests.test_default_connection_thread_local:    on SQLite, close() doesn't explicitly close in-memory connections.- servers.tests.LiveServerInMemoryDatabaseLockTest- test_runner.tests.SQLiteInMemoryTestDbs.test_transaction_supportCheck outpython/cpython#108015.
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@vstinnervstinnervstinner approved these changes

@felixxmfelixxmfelixxm left review comments

@berkerpeksagberkerpeksagAwaiting requested review from berkerpeksagberkerpeksag is a code owner

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

Emit resource warning if sqlite3 fails to close the database
4 participants
@erlend-aasland@felixxm@vstinner@bedevere-bot

[8]ページ先頭

©2009-2025 Movatter.jp