mirror of
https://github.com/micropython/micropython.git
synced 2026-01-05 03:30:14 +01:00
py: Add m_malloc_fail function to handle memory allocation error.
A malloc/realloc fail now throws MemoryError.
This commit is contained in:
@@ -17,6 +17,9 @@ typedef struct _mp_obj_exception_t {
|
||||
mp_obj_tuple_t args;
|
||||
} mp_obj_exception_t;
|
||||
|
||||
// Instance of MemoryError exception - needed by mp_malloc_fail
|
||||
const mp_obj_exception_t mp_const_MemoryError_obj = {{&mp_type_MemoryError}, MP_OBJ_NULL, {{&mp_type_tuple}, 0}};
|
||||
|
||||
// Instance of GeneratorExit exception - needed by generator.close()
|
||||
// This would belong to objgenerator.c, but to keep mp_obj_exception_t
|
||||
// definition module-private so far, have it here.
|
||||
|
||||
Reference in New Issue
Block a user