#21994·mypy

Narrow built-in signature hook return types to CallableType

Author: adamtheturtleCreated Sep 16, 2026Updated Sep 17, 2026
Labelsfeaturetopic-plugins

DefaultPlugin.get_function_signature_hook and get_method_signature_hook are annotated as returning callbacks that produce FunctionLike. In current master, every callback they return produces CallableType (including singledispatch's fallback).

This makes plugins that delegate to Mypy's default hooks use an assertion or cast before transforming the signature. Could these internal return annotations be narrowed to CallableType? The public Plugin hook API can remain FunctionLike.

Downstream example: mypy-strict-kwargs#858.