Skip to content

Commit 6632700

Browse files
committed
py: change negative array indices with array - 1.
1 parent 27bf5b8 commit 6632700

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

py/vm.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ bool mp_execute_byte_code_2(const byte **ip_in_out, mp_obj_t *fastn, mp_obj_t **
7878

7979
volatile machine_uint_t currently_in_except_block = 0; // 0 or 1, to detect nested exceptions
8080
machine_uint_t exc_stack[8]; // on the exception stack we store (ip, sp | X) for each block, X = previous value of currently_in_except_block
81-
machine_uint_t *volatile exc_sp = &exc_stack[-1]; // stack grows up, exc_sp points to top of stack
81+
machine_uint_t *volatile exc_sp = &exc_stack[0] - 1; // stack grows up, exc_sp points to top of stack
8282

8383
// outer exception handling loop
8484
for (;;) {
@@ -453,7 +453,7 @@ bool mp_execute_byte_code_2(const byte **ip_in_out, mp_obj_t *fastn, mp_obj_t **
453453
case MP_BC_RETURN_VALUE:
454454
nlr_pop();
455455
*sp_in_out = sp;
456-
assert(exc_sp == &exc_stack[-1]);
456+
assert(exc_sp == &exc_stack[0] - 1);
457457
return false;
458458

459459
case MP_BC_YIELD_VALUE:

0 commit comments

Comments
 (0)