Skip to content

Commit 1f4031c

Browse files
authored
Add __code__ to types.MethodType (#12749)
1 parent 8bc20e7 commit 1f4031c

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

stdlib/@tests/stubtest_allowlists/common.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -494,6 +494,7 @@ typing(_extensions)?\.TextIO\.newlines
494494
typing(_extensions)?\.(Async)?ContextManager
495495

496496
types.MethodType.__closure__ # read-only but not actually a property; stubtest thinks it doesn't exist.
497+
types.MethodType.__code__ # read-only but not actually a property; stubtest thinks it doesn't exist.
497498
types.MethodType.__defaults__ # read-only but not actually a property; stubtest thinks it doesn't exist.
498499
types.ModuleType.__dict__ # read-only but not actually a property; stubtest thinks it's a mutable attribute.
499500
types.ModuleType.__getattr__ # this doesn't exist at runtime

stdlib/types.pyi

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,8 @@ class MethodType:
424424
@property
425425
def __closure__(self) -> tuple[CellType, ...] | None: ... # inherited from the added function
426426
@property
427+
def __code__(self) -> CodeType: ... # inherited from the added function
428+
@property
427429
def __defaults__(self) -> tuple[Any, ...] | None: ... # inherited from the added function
428430
@property
429431
def __func__(self) -> Callable[..., Any]: ...

0 commit comments

Comments
 (0)