fix: make _handle param f positional-only to avoid kwarg conflict#840
Closed
weiguangli-io wants to merge 1 commit intoAnswerDotAI:mainfrom
Closed
fix: make _handle param f positional-only to avoid kwarg conflict#840weiguangli-io wants to merge 1 commit intoAnswerDotAI:mainfrom
_handle param f positional-only to avoid kwarg conflict#840weiguangli-io wants to merge 1 commit intoAnswerDotAI:mainfrom
Conversation
…lict When a route handler has a parameter named `f`, calling `_handle(f, **wreq)` raises "got multiple values for argument f" because `wreq` also contains `f` from the form data. Adding `/` after `f` makes it positional-only, so `f` in `**kwargs` no longer conflicts with the function's first parameter. Closes AnswerDotAI#834 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Found 1 changed notebook. Review the changes at https://app.gitnotebooks.com/AnswerDotAI/fasthtml/pull/840 |
Open
4 tasks
Author
|
Closing — shifting focus to AI Agent core projects. Thank you for your time! |
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 #834
Summary
When a POST route handler takes
fas a form-data parameter,_handle(f, **wreq)raises:because
wreqcontainsffrom the form data whilefis also passed positionally as the handler function.Fix
Add
/afterfin_handle's signature to make it positional-only:This is the standard Python pattern for functions that forward
**kwargs(seefunctools.partial,functools.reduce, etc.). Thefparameter can only be passed positionally, sof=<value>in**kwargsno longer conflicts.Updated both the notebook source (
nbs/api/00_core.ipynb) and generated files (core.py,core.pyi).