Skip to content

Commit ac87de5

Browse files
rowilliaJelleZijlstra
authored andcommitted
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' ```
1 parent 9b612c9 commit ac87de5

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

stdlib/2/types.pyi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ class UnboundMethodType:
8282
im_class = ... # type: type
8383
im_func = ... # type: FunctionType
8484
im_self = ... # type: Optional[object]
85+
__name__ = ... # type: str
8586
__func__ = im_func
8687
__self__ = im_self
8788
def __call__(self, *args: Any, **kwargs: Any) -> Any: ...

stdlib/3/types.pyi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ class _StaticFunctionType:
139139
class MethodType:
140140
__func__ = ... # type: _StaticFunctionType
141141
__self__ = ... # type: object
142+
__name__ = ... # type: str
142143
def __call__(self, *args: Any, **kwargs: Any) -> Any: ...
143144
class BuiltinFunctionType:
144145
__self__ = ... # type: Union[object, ModuleType]

0 commit comments

Comments
 (0)