QUERY · ISSUE
py: settrace is incompatible with Interrupt Handlers
py-core
When MICROPY_PY_SYS_SETTRACE is enabled, bytecode execution allocates RAM, which is forbidden on interrupt handlers.
https://github.com/micropython/micropython/blob/4d9e657f0ee881f4a41093ab89ec91d03613744d/py/vm.c#L142-L149
https://github.com/micropython/micropython/blob/e9e9c76ddf131f8e50b0ae2d44501d3cd88537ef/py/profile.c#L315-L318
CANDIDATE · PULL REQUEST
py/profile.c: Remove the requirement to disable the const optimisation when using sys.settrace.
py-core
The only reason that const had to be disabled was to make the test
output match CPython when const was involved. Instead, this commit
fixes the test to handle the lines where const is used.
Also:
- make the sys_settrace_features.py test work against newer CPython versions
- remove the special handling for MICROPY_PERSISTENT_CODE_SAVE in
unix/mpconfigport.h, and make this automatic. - move the check for MICROPY_PERSISTENT_CODE_SAVE to where it's used
(like we do for other similar checks) and add a comment explaining
it.
cc @andrewleech -- this is to support maybe making it possible to enable sys.settrace by default (see #12280).
This work was funded through GitHub Sponsors.