Repository navigation
Return None from bisect insort - #9630
Closed
youknowdot wants to merge 2 commits into
Closed
youknowdot wants to merge 2 commits into
youknowdot wants to merge 2 commits into
Conversation
Discard the result of a custom insert method while retaining the input and key until that result is released, matching CPython. Assisted-by: OpenAI Codex:model version not exposed
Contributor
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Assisted-by: dot:frontier-intelligence
youknowdot
pushed a commit
to youknowdot/RustPython
that referenced
this pull request
Nov 6, 2026
Absorb PR RustPython#9630 at 2839517. Its result-disposal fix is already included. The final redundant-clone expectations are superseded by borrowed arguments, which retain inputs through result disposal without those clones. Assisted-by: dot:frontier-intelligence
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.
Consolidated into #9629
Closed after verifying #9629 at
1eae2eb5b1534c20bfd79f9befc0075661096136includes this branch's latest head28395170fc393de1ecb337ffe3abf23d4cf4c9dfas an ancestor. Both insort result-disposal and argument-lifetime behavior are preserved. The final redundant-clone lint expectations are superseded by borrowed arguments.The combined change passed native bisect tests, CPython 3.15 differential probes, full workspace and separate C-API Rust tests, and both strict Clippy runs.
Summary
Discard the result of a custom sequence's
insert()in both_bisect.insortdirections and returnNone, as CPython does. Keep the input and key objects alive through destruction of that result, so its finalizer cannot observe them being released prematurely. Search and insertion exceptions still propagate.Scope and integration
Existing differences in lo/hi argument lifetime and callback order, as well as the lack of an exact-list native insertion fast path, remain separate. The bounds-order follow-on on #9629 now conflicts textually with this branch's insort hunks. A manually composed version retaining this PR's result-discard and ownership behavior has been independently source-reviewed; no merge has been performed.
Validation
_bisectmodule.c. CPython 3.15 reproductions confirmed both directions return None for aninsert()returning a sentinel and release an ephemeral insertion result before the input and key objects.