Repository navigation
gh-144377: Clean up sqlite3 Connection's list of weakrefs to Cursor objects - #144378
Merged
Merged
Conversation
takluyver
requested review from
berkerpeksag and
erlend-aasland
as code owners
February 1, 2026 11:10
takluyver
force-pushed
the
sqlite-no-register-cursors
branch
from
February 2, 2026 15:53
f65eac1 to
203cb74
Compare
vstinner
approved these changes
Feb 3, 2026
| Py_ssize_t imax = PyList_GET_SIZE(self->cursors); | ||
| for (Py_ssize_t i = 0; i < imax; i++) { | ||
| PyObject* weakref = PyList_GET_ITEM(self->cursors, i); | ||
| if (_PyWeakref_IsDead(weakref)) { |
Member
There was a problem hiding this comment.
Since the internal _PyWeakref_IsDead() function is no longer used, you can remove #include "pycore_weakref.h".
Contributor
Author
There was a problem hiding this comment.
Will do, but this made me realise that there's no equivalent function to clean up self->blobs, which otherwise is a parallel of self->cursors. So if you have a long-lived connection object and keep using conn.blobopen(), the list of weakrefs will grow indefinitely.
Is that a problem, or am I missing something?
Member
There was a problem hiding this comment.
Is that a problem, or am I missing something?
If you consider that it's an issue, please open a separated issue. It's not directly related to this change.
Member
|
Merged. Thanks for the cleanup change. |
This was referenced Feb 3, 2026
Aniketsy
pushed a commit
to Aniketsy/cpython
that referenced
this pull request
Feb 3, 2026
thunder-coding
pushed a commit
to thunder-coding/cpython
that referenced
this pull request
Feb 15, 2026
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This cleans up the code for an unused (as far as I can see) list of Cursor weakrefs.
Closes #144377