Freezing modules having native and viper functions

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
User avatar
jimmo
Posts: 2754
Joined: Tue Aug 08, 2017 1:57 am
Location: Sydney, Australia
Contact:

Re: Freezing modules having native and viper functions

Post by jimmo » Sun Aug 18, 2019 12:45 pm

OK thanks for the detailed repro instructions. It looks like I might be able to run this code without anything connected and the driver won't complain, hopefully can repro that way. Will let you know.

Otherwise...might just have to order one of those displays... :)

User avatar
jimmo
Posts: 2754
Joined: Tue Aug 08, 2017 1:57 am
Location: Sydney, Australia
Contact:

Re: Freezing modules having native and viper functions

Post by jimmo » Tue Aug 20, 2019 5:48 am

The fix for original issue with alignment is now merged. #5014

@pythoncoder's follow up issue I'm still investigating. There appears to be an issue calling a @native function that calls another @native/@viper function when the globals change (e.g. across a module). It seems that a workaround in the meantime is to make any @native function module-private, and always call it via a regular function in the same scope. (It looks like the native emitter that doesn't correctly save/restore the globals dict).

Post Reply