Skip to content

Fix: add_sig_param: pass annotation to Parameter - #917

Merged
jph00 merged 1 commit into
mainfrom
fix/sig-param-annotation
Aug 19, 2026
Merged

Fix: add_sig_param: pass annotation to Parameter#917
jph00 merged 1 commit into
mainfrom
fix/sig-param-annotation

Conversation

@RensDimmendaal

@RensDimmendaal RensDimmendaal commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

add_sig_param builds the injected Parameter without annotation=, storing the type only in f.__annotations__. This used to work because fastcore's old signature_ex merged __annotations__ back over an explicit __signature__, an undocumented side effect of its pre-3.10 backport.

The signature_ex rewrite in fastcore delegates to stock inspect.signature, which returns __signature__ verbatim. Injected params therefore arrive with no annotation and are ignored by the request machinery. Which explains the failing test in #916

Fix: pass annotation=typ when constructing the Parameter, putting the type in the signature itself.

@RensDimmendaal RensDimmendaal added the bug Something isn't working label Aug 12, 2026
@RensDimmendaal
RensDimmendaal requested a review from jph00 August 13, 2026 03:55
@jph00
jph00 merged commit 5a47be3 into main Aug 19, 2026
3 checks passed
@jph00
jph00 deleted the fix/sig-param-annotation branch August 19, 2026 06:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants