Skip to content

fix(core): rename parameter f to _f in _handle to prevent keyword argument collisions#894

Closed
Hasnaathussain wants to merge 1 commit into
AnswerDotAI:mainfrom
Hasnaathussain:fix/834-wrapper-argument-f-collision
Closed

fix(core): rename parameter f to _f in _handle to prevent keyword argument collisions#894
Hasnaathussain wants to merge 1 commit into
AnswerDotAI:mainfrom
Hasnaathussain:fix/834-wrapper-argument-f-collision

Conversation

@Hasnaathussain

@Hasnaathussain Hasnaathussain commented Jun 28, 2026

Copy link
Copy Markdown

When route handlers accept an argument named f (representing a file, form, or general parameter), invoking the handler via FastHTML's _handle function raises TypeError: _handle() got multiple values for argument 'f'.

This is because the first positional argument of _handle is named f, which collides with the keyword argument unpacked from the request payload.

This PR renames the parameter in _handle from f to _f (both in the source notebook nbs/api/00_core.ipynb and the exported fasthtml/core.py) to prevent keyword collisions.

I've also added a regression test demonstrating route registration and invocation with parameter f working seamlessly.

Closes #834

Copilot AI review requested due to automatic review settings June 28, 2026 09:16

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@jph00

jph00 commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

In nbdev we don't put tests in a separate file. Please follow the project's coding style.

@jph00 jph00 closed this Jun 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] "_handle got multiple values for argument f" when a POST route takes f as an argument

3 participants