diff options
author | Dave Hylands <dhylands@gmail.com> | 2014-06-30 22:49:21 -0700 |
---|---|---|
committer | Dave Hylands <dhylands@gmail.com> | 2014-06-30 22:49:21 -0700 |
commit | 2fe841d2fa022bc7f546ddd77a79eaa0150bdf87 (patch) | |
tree | 73b3359c114fd7462654dff2297e09eecaaca11d /py/objexcept.c | |
parent | 8993fb6cf0677ce980ab56cbad326e4e6bc47811 (diff) |
Try not to cause a MemoryError when raising an exception during nterrupt handling.
Step 1 fixes #732
Diffstat (limited to 'py/objexcept.c')
-rw-r--r-- | py/objexcept.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/py/objexcept.c b/py/objexcept.c index 9f421373b..b4a831c62 100644 --- a/py/objexcept.c +++ b/py/objexcept.c @@ -37,6 +37,7 @@ #include "objtype.h" #include "runtime.h" #include "runtime0.h" +#include "gc.h" typedef struct _mp_obj_exception_t { mp_obj_base_t base; @@ -335,6 +336,10 @@ void mp_obj_exception_clear_traceback(mp_obj_t self_in) { } void mp_obj_exception_add_traceback(mp_obj_t self_in, qstr file, machine_uint_t line, qstr block) { + if (gc_is_locked()) { + // We can't allocate memory, so don't bother to try + return; + } GET_NATIVE_EXCEPTION(self, self_in); // for traceback, we are just using the list object for convenience, it's not really a list of Python objects |