[python][apps/code] Enable interrupting python execution

Change-Id: Iadf7038f79f0289ce20d7ded42f8fe70894f0c0a
This commit is contained in:
Émilie Feral
2017-08-24 10:41:29 +02:00
parent 8c86b62df6
commit 52f5858ffd
9 changed files with 83 additions and 2 deletions

View File

@@ -29,6 +29,11 @@
#include <string.h>
#include <assert.h>
/* TODO: We should rather not edit micropython file.
* Begining of the edited part */
#include "../../port/interrupt_helper.h"
/* End of the edited part */
#include "py/mpstate.h"
#include "py/nlr.h"
#include "py/emitglue.h"
@@ -1278,6 +1283,12 @@ yield:
pending_exception_check:
MICROPY_VM_HOOK_LOOP
/* TODO: We should rather not edit micropython file. Find a way to call
* shouldInterrupt every now and then in the loop executing byte code without
* editing this file.
* Begining of the edited part */
shouldInterrupt();
/* End of the edited part */
#if MICROPY_ENABLE_SCHEDULER
// This is an inlined variant of mp_handle_pending