Add __name__ field to MethodType (#1442)

See 08c16016e2/Lib/types.py (L32-L34)

```python
>>> class _C:
...     def _m(self): pass
...
>>> _C()._m.__name__
'_m'
```
This commit is contained in:
Roy Williams
2017-06-29 10:05:25 -07:00
committed by Jelle Zijlstra
parent 9b612c9218
commit ac87de50dd
2 changed files with 2 additions and 0 deletions

View File

@@ -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: ...

View File

@@ -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]