Skip to content

Narrow built-in signature hook return types - #21995

Open
adamtheturtle wants to merge 1 commit into
python:masterfrom
adamtheturtle:typing/narrow-default-signature-hooks
Open

adamtheturtle wants to merge 1 commit into
python:masterfrom
adamtheturtle:typing/narrow-default-signature-hooks

Conversation

@adamtheturtle

@adamtheturtle adamtheturtle commented Sep 16, 2026

Copy link
Copy Markdown

Fixes #21994.

All built-in signature hooks return CallableType, but DefaultPlugin exposes their callbacks as returning FunctionLike. Narrow the two hook annotations and the singledispatch callback; leave the public Plugin API unchanged. This lets downstream wrappers delegate to built-in hooks without an assertion or cast.

@github-actions

Copy link
Copy Markdown
Contributor

According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅

@adamtheturtle
adamtheturtle marked this pull request as draft September 16, 2026 11:42
@adamtheturtle
adamtheturtle marked this pull request as ready for review September 16, 2026 13:58
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.

Narrow built-in signature hook return types to CallableType

1 participant