mirror of
https://github.com/micropython/micropython.git
synced 2026-01-06 12:10:13 +01:00
py: Wrap all obj-ptr conversions in MP_OBJ_TO_PTR/MP_OBJ_FROM_PTR.
This allows the mp_obj_t type to be configured to something other than a pointer-sized primitive type. This patch also includes additional changes to allow the code to compile when sizeof(mp_uint_t) != sizeof(void*), such as using size_t instead of mp_uint_t, and various casts.
This commit is contained in:
@@ -39,7 +39,7 @@ STATIC NORETURN void raise_exc(mp_obj_t exc, mp_lexer_t *lex) {
|
||||
// if lex!=NULL then the parser called us and we need to convert the
|
||||
// exception's type from ValueError to SyntaxError and add traceback info
|
||||
if (lex != NULL) {
|
||||
((mp_obj_base_t*)exc)->type = &mp_type_SyntaxError;
|
||||
((mp_obj_base_t*)MP_OBJ_TO_PTR(exc))->type = &mp_type_SyntaxError;
|
||||
mp_obj_exception_add_traceback(exc, lex->source_name, lex->tok_line, MP_QSTR_NULL);
|
||||
}
|
||||
nlr_raise(exc);
|
||||
|
||||
Reference in New Issue
Block a user