Fixes for native module support#6014
Conversation
jepler
left a comment
There was a problem hiding this comment.
Part of this is right, and part I am unsure about; it seemed to cause problems for me.
| } | ||
| mp_parent_t parent = mp_type_get_parent_slot(self_type); | ||
| if (parent != native_type) { |
There was a problem hiding this comment.
this is probably correct for us. It looks like this is an incorrect trace of my work to split type objects into a main part and an optional part; the 'parent' field ended up in the main part, but this code was to help adapt for the case that it was in the optional part.
| #if defined(__GNUC__) | ||
| NORETURN // Only certain compilers support no-return attributes in function pointer declarations | ||
| #endif | ||
| void (*raise_msg_str)(const mp_obj_type_t *exc_type, const char *msg); |
There was a problem hiding this comment.
Does raising exceptions from a native module actually work with these changes? I expect that it doesn't, because there's no way for the string to be entered in the list of translations that is baked into the core, and the translate() function is not available to call from the dynamic runtime either.
|
Closing in favor of #6028. Thanks again for starting this off! |
I did a proof of concept to get native modules to work in CP. There were a few changes required to get everything compiling properly and updated after all the MP merges. What is in this PR are basically bug fixes in code paths not ran during normal CP operation. They are not encountered unless the native mpy flag is enabled.
To enable the
CIRCUITPY_ENABLE_MPY_NATIVEneeds to be set to 1.This change does not enable native modules in any build.