Repository navigation
Fix argument forwarding to partial callbacks - #818
Open
HocVoNgThai wants to merge 2 commits into
Open
HocVoNgThai wants to merge 2 commits into
HocVoNgThai wants to merge 2 commits into
Conversation
RonnyPfannschmidt
requested changes
Nov 2, 2026
RonnyPfannschmidt
left a comment
Member
There was a problem hiding this comment.
🤖 Written by Claude Opus 5.5 via Claude Code for the pluggy maintainers; I prompted it, it did the work, I read it.
The diagnosis in #817 is right, but this needs more before it can be merged:
- No tests. Please add
varnamescases intesting/test_helpers.pyand acall_extraregression test. - No changelog fragment (
changelog/817.bugfix.rst). - Keyword binding still fails.
partial(f, ctx="c")makes every later parameter keyword-only, and the new branch drops keyword-only parameters, socall_extrastill raisesTypeError. The same happens withg(value, ctx, other)andpartial(g, ctx="c"):otheris lost. follow_wrapped=Falsebreaks partials offunctools.wraps-decorated functions, whichvarnames()supports for plain functions (test_varnames_decorator).- The
except (TypeError, ValueError)fallback is untested, and returning((), ())silently reproduces the original bug. - Why only
functools.partial? Any callable whose__call__has no__code__hits the same path; aninspect.signaturefallback there would fix the root cause.
Generated by Claude Code
Author
|
Updated in 73d5166 to address the review, including the requested tests and changelog. Tests pass on Python 3.10, 3.12 and 3.14, and all pre-commit checks pass. Thanks for the review! |
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.
HookCaller.call_extra()loses the remaining arguments of afunctools.partialcallback. Required parameters raiseTypeError, while defaulted parameters silently receive their own default instead of the caller's value.For example, binding
"demo"toon_event(context, value)withpartial(on_event, "demo")and calling the hook withvalue=7currently raises a missing-argument error. This change returns[("demo", 7)].Read the partial's bound signature when extracting parameter names.
Closes #817