diff options
author | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2014-03-30 00:48:21 +0200 |
---|---|---|
committer | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2014-03-30 01:01:35 +0200 |
commit | 0c904df8e6c4cf9123a837861b97585a61b3d8df (patch) | |
tree | 9ff8dbdbb02b300f6b08a3570ea9e3e408bcb4b7 /py/bc.h | |
parent | 69975df3fffaae5f11caa6663f01f4a876d3ab41 (diff) | |
download | micropython-0c904df8e6c4cf9123a837861b97585a61b3d8df.tar.gz micropython-0c904df8e6c4cf9123a837861b97585a61b3d8df.zip |
vm: Save current active exception on opening new try block.
Required to reraise correct exceptions in except block, regardless if more
try blocks with active exceptions happen in the same except block.
P.S. This "automagic reraise" appears to be quite wasteful feature of Python
- we need to save pending exception just in case it *might* be reraised.
Instead, programmer could explcitly capture exception to a variable using
"except ... as var", and reraise that. So, consider disabling argless raise
support as an optimization.
Diffstat (limited to 'py/bc.h')
-rw-r--r-- | py/bc.h | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -9,6 +9,8 @@ typedef struct _mp_exc_stack { const byte *handler; // bit 0 is saved currently_in_except_block value mp_obj_t *val_sp; + // Saved exception, valid if currently_in_except_block bit is 1 + mp_obj_t prev_exc; // We might only have 2 interesting cases here: SETUP_EXCEPT & SETUP_FINALLY, // consider storing it in bit 1 of val_sp. TODO: SETUP_WITH? byte opcode; |