Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
finagle
  • Loading branch information
srittau committed Sep 10, 2026
commit 202ab99790a9b1e43a67ae0f7badabccbcf7802d
2 changes: 1 addition & 1 deletion stdlib/@tests/test_cases/check_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@
return x


def fake_method(self: MethodTypeTest, x: int) -> int:
def fake_method(self: MethodTypeTest, /, x: int) -> int:
return x


bound_method1 = MethodTypeTest().method
assert isinstance(bound_method1, types.MethodType)
assert_type(bound_method1(42), int)

Check failure on line 25 in stdlib/@tests/test_cases/check_types.py

View workflow job for this annotation

GitHub Actions / pyright: regression tests (Linux, 3.13)

"assert_type" mismatch: expected "int" but received "Unknown" (reportAssertTypeFailure)

bound_method2 = types.MethodType(MethodTypeTest.method, MethodTypeTest())
assert isinstance(bound_method2, types.MethodType)
Expand Down
3 changes: 2 additions & 1 deletion stdlib/types.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,8 @@ class MethodType(Generic[_P_default, _R_default]):
def __name__(self) -> str: ... # inherited from the added function
@property
def __qualname__(self) -> str: ... # inherited from the added function
def __new__(cls, func: Callable[Concatenate[object, _P_default], _R_default], instance: object, /) -> Self: ...
# First func argument is usually "self".
def __new__(cls, func: Callable[Concatenate[Any, _P_default], _R_default], instance: object, /) -> Self: ...
def __call__(self, *args: _P_default.args, **kwargs: _P_default.kwargs) -> _R_default: ...

if sys.version_info >= (3, 13):
Expand Down
Loading