Skip to content

Improve decorator type error message for decorated functions (#16295)#20381

Open
LeoLomardo wants to merge 7 commits intopython:masterfrom
LeoLomardo:newfeature
Open

Improve decorator type error message for decorated functions (#16295)#20381
LeoLomardo wants to merge 7 commits intopython:masterfrom
LeoLomardo:newfeature

Conversation

@LeoLomardo
Copy link
Copy Markdown

This PR is related with the issue #16295

Checklist:

  • Clarifies error reporting when a decorator (or decorator factory) supplies an incompatible callable signature, including the decorated function’s name.
  • Adds regression test for decorator factory application to verify the detailed message.

@github-actions

This comment has been minimized.

	deleted:    long_functions.csv
removed long_functions.csv because it is no longer needed in the project.
@github-actions

This comment has been minimized.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Dec 9, 2025

Diff from mypy_primer, showing the effect of this PR on open source code:

prefect (https://github.com/PrefectHQ/prefect)
- src/prefect/client/schemas/objects.py:306: error: Argument 1 has incompatible type "Callable[[State[R], bool, bool], R | Exception]"; expected "Callable[[State[R], Literal[True], bool], R]"  [arg-type]
+ src/prefect/client/schemas/objects.py:306: error: Decorated function "result" has incompatible type "Callable[[State[R], bool, bool], R | Exception]"; expected "Callable[[State[R], Literal[True], bool], R]"  [arg-type]

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.

2 participants