diff options
Diffstat (limited to 'shared-bindings/memorymonitor')
| -rw-r--r-- | shared-bindings/memorymonitor/AllocationAlarm.c | 6 | ||||
| -rw-r--r-- | shared-bindings/memorymonitor/AllocationSize.c | 12 | ||||
| -rw-r--r-- | shared-bindings/memorymonitor/__init__.c | 7 |
3 files changed, 12 insertions, 13 deletions
diff --git a/shared-bindings/memorymonitor/AllocationAlarm.c b/shared-bindings/memorymonitor/AllocationAlarm.c index 36e2cb5b2..7de8c1287 100644 --- a/shared-bindings/memorymonitor/AllocationAlarm.c +++ b/shared-bindings/memorymonitor/AllocationAlarm.c @@ -35,7 +35,7 @@ //| class AllocationAlarm: //| -//| def __init__(self, *, minimum_block_count=1): +//| def __init__(self, *, minimum_block_count: int = 1) -> None: //| """Throw an exception when an allocation of ``minimum_block_count`` or more blocks //| occurs while active. //| @@ -76,7 +76,7 @@ STATIC mp_obj_t memorymonitor_allocationalarm_make_new(const mp_obj_type_t *type return MP_OBJ_FROM_PTR(self); } -//| def ignore(self, count) -> AllocationAlarm: +//| def ignore(self, count: int) -> AllocationAlarm: //| """Sets the number of applicable allocations to ignore before raising the exception. //| Automatically set back to zero at context exit. //| @@ -98,7 +98,7 @@ STATIC mp_obj_t memorymonitor_allocationalarm_obj_ignore(mp_obj_t self_in, mp_ob } MP_DEFINE_CONST_FUN_OBJ_2(memorymonitor_allocationalarm_ignore_obj, memorymonitor_allocationalarm_obj_ignore); -//| def __enter__(self) -> memorymonitor.AllocationAlarm: +//| def __enter__(self) -> AllocationAlarm: //| """Enables the alarm.""" //| ... //| diff --git a/shared-bindings/memorymonitor/AllocationSize.c b/shared-bindings/memorymonitor/AllocationSize.c index 501674441..b35bae360 100644 --- a/shared-bindings/memorymonitor/AllocationSize.c +++ b/shared-bindings/memorymonitor/AllocationSize.c @@ -35,7 +35,7 @@ //| class AllocationSize: //| -//| def __init__(self): +//| def __init__(self) -> None: //| """Tracks the number of allocations in power of two buckets. //| //| It will have 16 16-bit buckets to track allocation counts. It is total allocations @@ -72,7 +72,7 @@ STATIC mp_obj_t memorymonitor_allocationsize_make_new(const mp_obj_type_t *type, return MP_OBJ_FROM_PTR(self); } -//| def __enter__(self, ) -> Any: +//| def __enter__(self) -> AllocationSize: //| """Clears counts and resumes tracking.""" //| ... //| @@ -83,7 +83,7 @@ STATIC mp_obj_t memorymonitor_allocationsize_obj___enter__(mp_obj_t self_in) { } MP_DEFINE_CONST_FUN_OBJ_1(memorymonitor_allocationsize___enter___obj, memorymonitor_allocationsize_obj___enter__); -//| def __exit__(self, ) -> Any: +//| def __exit__(self) -> None: //| """Automatically pauses allocation tracking when exiting a context. See //| :ref:`lifetime-and-contextmanagers` for more info.""" //| ... @@ -95,7 +95,7 @@ STATIC mp_obj_t memorymonitor_allocationsize_obj___exit__(size_t n_args, const m } STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(memorymonitor_allocationsize___exit___obj, 4, 4, memorymonitor_allocationsize_obj___exit__); -//| bytes_per_block: int = ... +//| bytes_per_block: int //| """Number of bytes per block""" //| STATIC mp_obj_t memorymonitor_allocationsize_obj_get_bytes_per_block(mp_obj_t self_in) { @@ -112,7 +112,7 @@ const mp_obj_property_t memorymonitor_allocationsize_bytes_per_block_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| def __len__(self, ) -> Any: +//| def __len__(self) -> int: //| """Returns the number of allocation buckets. //| //| This allows you to:: @@ -131,7 +131,7 @@ STATIC mp_obj_t memorymonitor_allocationsize_unary_op(mp_unary_op_t op, mp_obj_t } } -//| def __getitem__(self, index: Any) -> Any: +//| def __getitem__(self, index: int) -> Optional[int]: //| """Returns the allocation count for the given bucket. //| //| This allows you to:: diff --git a/shared-bindings/memorymonitor/__init__.c b/shared-bindings/memorymonitor/__init__.c index 98f48f525..c101ba5e0 100644 --- a/shared-bindings/memorymonitor/__init__.c +++ b/shared-bindings/memorymonitor/__init__.c @@ -36,10 +36,9 @@ //| """Memory monitoring helpers""" //| -//| class AllocationError: -//| def __init__(self, Exception: Any): -//| """Catchall exception for allocation related errors.""" -//| ... +//| class AllocationError(Exception): +//| """Catchall exception for allocation related errors.""" +//| ... MP_DEFINE_MEMORYMONITOR_EXCEPTION(AllocationError, Exception) NORETURN void mp_raise_memorymonitor_AllocationError(const compressed_string_t* fmt, ...) { |
