Model fallback MethodType => FunctionType

This commit is contained in:
David Peter
2025-02-20 15:22:05 +01:00
parent 8a08325b9a
commit 0fa827fa32
2 changed files with 20 additions and 2 deletions

View File

@@ -89,6 +89,14 @@ If we access an attribute on a bound method object itself, it will defer to `typ
reveal_type(bound_method.__hash__) # revealed: <bound method `__hash__` of `MethodType`>
```
If an attribute is not available on the bound method object, it will be looked up on the underlying
function object. We model this explicitly, which means that we can access `__module__` on bound
methods, even though it is not available on `types.MethodType`:
```py
reveal_type(bound_method.__module__) # revealed: str
```
## Basic method calls on class objects and instances
```py