← index #7372PR #12285
Related · high · value 2.145
QUERY · ISSUE

py: settrace is incompatible with Interrupt Handlers

openby amirgonopened 2021-06-08updated 2021-06-09
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.

mergedby jimmoopened 2023-08-23updated 2023-08-30
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.

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied