diff options
author | Damien George <damien@micropython.org> | 2023-05-09 11:03:04 +1000 |
---|---|---|
committer | Damien George <damien@micropython.org> | 2023-06-02 21:50:57 +1000 |
commit | 2757acf6ed1fe165e4d8aa72ba8090fb9bc60c31 (patch) | |
tree | 5e5147282e4f70da121c7868ac2ce8983e441086 /py/modarray.c | |
parent | f36ae5edcb5556c35b2dfe10be7ba54a21da0c9b (diff) |
py/nlr: Implement jump callbacks.
NLR buffers are usually quite large (use lots of C stack) and expensive to
push and pop. Some of the time they are only needed to perform clean up if
an exception happens, and then they re-raise the exception.
This commit allows optimizing that scenario by introducing a linked-list of
NLR callbacks that are called automatically when an exception is raised.
They are essentially a light-weight NLR handler that can implement a
"finally" block, i.e. clean-up when an exception is raised, or (by passing
`true` to nlr_pop_jump_callback) when execution leaves the scope.
Signed-off-by: Damien George <damien@micropython.org>
Diffstat (limited to 'py/modarray.c')
0 files changed, 0 insertions, 0 deletions