Conversation
Owner
|
Nice! |
This was referenced 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.
Closes #454 and #465 .
@boxed In case you want to review, this is a slightly bigger change of trampoline internals. This PR adds some complexity at the trampoline wrapper (handling various possible parameter formats, async declarations and async generators), but I think it's worth it so we can preserve the original function signature. Also, don't need to manually copy the signature with
trampoline.__signature__ = inspect.signature(original_method)anymore.With this change,
asyncio.iscoroutinefunction(async_func)also returns true after we mutated the function. This is done by using the same signature as it was originally, and adding some logic to pass our arguments to the trampoline.For instance:
Will be mutated to:
In the commit 944d43f, I've also added
inline-snapshot(+ruff formatting for the snapshots) to make it easier to work with regression snapshots. e.g. thetests/test_mutation regression.pyare useful to have and withinline-snapshotit's easier to update them whenever some implementation detail changes.The e2e tests and a sample repository I tried were not affected by this change, so I don't think it breaks existing functionality.