From ac87de50dd4dc3424357904d64e4db2a595f8275 Mon Sep 17 00:00:00 2001 From: Roy Williams Date: Thu, 29 Jun 2017 10:05:25 -0700 Subject: [PATCH] Add __name__ field to MethodType (#1442) 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 2896d1a37..e4df50d8e 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 3b32d83f4..9894742a3 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]