From 2fe841d2fa022bc7f546ddd77a79eaa0150bdf87 Mon Sep 17 00:00:00 2001 From: Dave Hylands Date: Mon, 30 Jun 2014 22:49:21 -0700 Subject: Try not to cause a MemoryError when raising an exception during nterrupt handling. Step 1 fixes #732 --- py/gc.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'py/gc.c') diff --git a/py/gc.c b/py/gc.c index 65bfea0b3..7aa5bc326 100644 --- a/py/gc.c +++ b/py/gc.c @@ -172,6 +172,10 @@ void gc_unlock(void) { gc_lock_depth--; } +bool gc_is_locked(void) { + return gc_lock_depth != 0; +} + #define VERIFY_PTR(ptr) ( \ (ptr & (BYTES_PER_BLOCK - 1)) == 0 /* must be aligned on a block */ \ && ptr >= (machine_uint_t)gc_pool_start /* must be above start of pool */ \ -- cgit v1.2.3