Repository navigation
Conversation
Collaborator
|
Review requested:
|
trivikr
force-pushed
the
sqlite-exhausted-iterators-return-2
branch
from
October 5, 2026 16:37
bbd7a1b to
5925401
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #66519 +/- ##
==========================================
+ Coverage 90.57% 90.59% +0.01%
==========================================
Files 797 797
Lines 278362 278364 +2
Branches 53497 53500 +3
==========================================
+ Hits 252138 252189 +51
+ Misses 16574 16521 -53
- Partials 9650 9654 +4
🚀 New features to boost your workflow:
|
Member
Author
|
cc @araujogui can you review this? |
araujogui
requested changes
Oct 15, 2026
araujogui
left a comment
Member
There was a problem hiding this comment.
nit: might be worth a line in the createModule() docs on when return() gets called.
Closing a virtual table cursor invoked the iterator's return() even after next() had already reported done: true, deviating from for...of semantics where return() only runs on abrupt termination. An empty custom iterable with a throwing return() made an otherwise successful query fail. Only close the iterator when the scan stopped early, as with LIMIT, a break, or a cursor re-filter; a normally finished iterator already ran its cleanup. Signed-off-by: Trivikram Kamat <16024985+trivikr@users.noreply.github.com> Assisted-by: claude:opus-5.5
trivikr
force-pushed
the
sqlite-exhausted-iterators-return-2
branch
from
October 21, 2026 06:46
5925401 to
b18715a
Compare
sqlite: skip return() on exhausted virtual table iterators Closing a virtual table cursor invoked the iterator's return() even after next() had already reported done: true, deviating from for...of semantics where return() only runs on abrupt termination. An empty custom iterable with a throwing return() made an otherwise successful query fail. Only close the iterator when the scan stopped early, as with LIMIT, a break, or a cursor re-filter; a normally finished iterator already ran its cleanup. Likewise, skip return() after an iterator protocol error, where next() is missing or returns a non-object, as for...of does not close the iterator in that case. Signed-off-by: Trivikram Kamat <16024985+trivikr@users.noreply.github.com> Assisted-by: claude:opus-5.5
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.
Fixes: #66518
Once a virtual table iterator's
next()reportsdone: true, the iterator is finished, soreturn()must not be called. This matchesfor...of, which callsreturn()only on abrupt termination. Before this change, an empty custom iterable with a throwingreturn()made an otherwise successful query fail.CloseIterator()now skips cursors whose iteration has completed. That covers bothxCloseand cursor re-filtering. Early termination (LIMIT,break, re-filter mid-scan) still callsreturn().Assisted-by: claude:opus-5.5