summaryrefslogtreecommitdiffstatshomepage
path: root/py/emitcpy.c
diff options
context:
space:
mode:
Diffstat (limited to 'py/emitcpy.c')
-rw-r--r--py/emitcpy.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/py/emitcpy.c b/py/emitcpy.c
index a8a6265b8c..4ff99866a0 100644
--- a/py/emitcpy.c
+++ b/py/emitcpy.c
@@ -30,8 +30,8 @@
#include <string.h>
#include <assert.h>
-#include "misc.h"
#include "mpconfig.h"
+#include "misc.h"
#include "qstr.h"
#include "lexer.h"
#include "parse.h"
@@ -792,6 +792,14 @@ STATIC void emit_cpy_yield_from(emit_t *emit) {
}
}
+STATIC void emit_cpy_start_except_handler(emit_t *emit) {
+ emit_cpy_adjust_stack_size(emit, 3); // stack adjust for the 3 exception items
+}
+
+STATIC void emit_cpy_end_except_handler(emit_t *emit) {
+ emit_cpy_adjust_stack_size(emit, -5); // stack adjust
+}
+
STATIC void emit_cpy_load_const_verbatim_str(emit_t *emit, const char *str) {
emit_pre(emit, 1, 3);
if (emit->pass == MP_PASS_EMIT) {
@@ -899,6 +907,9 @@ const emit_method_table_t emit_cpython_method_table = {
emit_cpy_yield_value,
emit_cpy_yield_from,
+ emit_cpy_start_except_handler,
+ emit_cpy_end_except_handler,
+
// emitcpy specific functions
emit_cpy_load_const_verbatim_str,
emit_cpy_load_closure,