Commit 08242eed authored by Damien George's avatar Damien George
Browse files

py/nlrsetjmp: Add check for failed NLR jump.

Also optimise the function so it only needs to call the MP_STATE_THREAD
macro once (following how other nlr code is written).
parent fe79234c
......@@ -29,10 +29,14 @@
void nlr_setjmp_jump(void *val) {
nlr_buf_t *buf = MP_STATE_THREAD(nlr_top);
MP_STATE_THREAD(nlr_top) = buf->prev;
buf->ret_val = val;
longjmp(buf->jmpbuf, 1);
nlr_buf_t **top_ptr = &MP_STATE_THREAD(nlr_top);
nlr_buf_t *top = *top_ptr;
if (top == NULL) {
top->ret_val = val;
*top_ptr = top->prev;
longjmp(top->jmpbuf, 1);
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment