Allow callables in _SourceObjectType (#3295)

This is important because mypy doesn't generally think functions are compatible with `FunctionType`, so `inspect.getsource` on arbitrary functions is rejected by the current annotations.
This commit is contained in:
Jelle Zijlstra
2019-10-02 15:52:21 -07:00
committed by Sebastian Rittau
parent eeb8daa467
commit c38cf6736e

View File

@@ -77,7 +77,7 @@ def ismemberdescriptor(object: object) -> bool: ...
#
# Retrieving source code
#
_SourceObjectType = Union[ModuleType, Type[Any], MethodType, FunctionType, TracebackType, FrameType, CodeType]
_SourceObjectType = Union[ModuleType, Type[Any], MethodType, FunctionType, TracebackType, FrameType, CodeType, Callable[..., Any]]
def findsource(object: _SourceObjectType) -> Tuple[List[str], int]: ...
def getabsfile(object: _SourceObjectType) -> str: ...