py, objexcept: Only check for locked gc if gc is enabled.

nlr-macros
Damien George 2014-07-01 14:28:09 +01:00
parent f065344d3b
commit f0b29729aa
1 changed files with 3 additions and 0 deletions

View File

@ -336,10 +336,13 @@ 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 MICROPY_ENABLE_GC
if (gc_is_locked()) {
// We can't allocate memory, so don't bother to try
return;
}
#endif
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