Repository navigation
fix: support implicit value conversions in native trampolines - #6204
Open
CAOShurong wants to merge 3 commits into
Open
CAOShurong wants to merge 3 commits into
CAOShurong wants to merge 3 commits into
Conversation
This branch has not been deployed
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.
Description
Fixes #6080.
When native C++ calls a Python override, an implicit conversion of the returned list to an opaque vector can fail because no loader frame is active. Keep conversion temporaries alive until the registered return value has been copied or moved out. Reuse an existing frame, and leave borrowed reference, pointer, and view returns unchanged.
The embedded-interpreter regression covers retained and temporary Python lists, shared ownership, temporary destruction, and rejection of borrowed results that would outlive a conversion frame. It fails on current master and passes with the fix.
Validation on Windows/MSVC and Python 3.13: all embedded C++ tests, eight CMake integration checks, packaging tests, and installed C++14 consumers in header-only and precompiled modes passed. The full Python suite had 1,311 passes, 53 skips, and eight chrono failures also reproduced on unchanged master. Debug builds with warnings as errors passed; Release builds hit C4702 on both master and this branch.
Suggested changelog entry: