From f8257884e96127e2fcb6e5f0519f0529ac88b0ce Mon Sep 17 00:00:00 2001 From: Roy Williams Date: Wed, 28 Jun 2017 14:11:38 -0700 Subject: [PATCH] Add __name__ field to MethodType See https://github.com/python/cpython/blob/08c16016e2a2d1368d001ddebfe9ca92465773c4/Lib/types.py#L32-L34 ```python >>> class _C: ... def _m(self): pass ... >>> _C()._m.__name__ '_m' ``` --- stdlib/2/types.pyi | 1 + stdlib/3/types.pyi | 1 + 2 files changed, 2 insertions(+) diff --git a/stdlib/2/types.pyi b/stdlib/2/types.pyi index 2896d1a37643..e4df50d8eec0 100644 --- a/stdlib/2/types.pyi +++ b/stdlib/2/types.pyi @@ -82,6 +82,7 @@ class UnboundMethodType: im_class = ... # type: type im_func = ... # type: FunctionType im_self = ... # type: Optional[object] + __name__ = ... # type: str __func__ = im_func __self__ = im_self def __call__(self, *args: Any, **kwargs: Any) -> Any: ... diff --git a/stdlib/3/types.pyi b/stdlib/3/types.pyi index 3b32d83f40e6..9894742a3047 100644 --- a/stdlib/3/types.pyi +++ b/stdlib/3/types.pyi @@ -139,6 +139,7 @@ class _StaticFunctionType: class MethodType: __func__ = ... # type: _StaticFunctionType __self__ = ... # type: object + __name__ = ... # type: str def __call__(self, *args: Any, **kwargs: Any) -> Any: ... class BuiltinFunctionType: __self__ = ... # type: Union[object, ModuleType]