From 973c87d8fa41c3ae0c46be4f234726ecc3ac9d8a Mon Sep 17 00:00:00 2001 From: Damien George Date: Thu, 22 Aug 2019 16:05:05 +1000 Subject: [PATCH] py/objgenerator: Move defn of mp_const_GeneratorExit_obj here. Because the mp_obj_exception_t type is now globally available. --- py/objexcept.c | 5 ----- py/objgenerator.c | 3 +++ 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/py/objexcept.c b/py/objexcept.c index 1fb636f666..7e3fdcc27c 100644 --- a/py/objexcept.c +++ b/py/objexcept.c @@ -100,11 +100,6 @@ mp_obj_t mp_alloc_emergency_exception_buf(mp_obj_t size_in) { #endif #endif // MICROPY_ENABLE_EMERGENCY_EXCEPTION_BUF -// Instance of GeneratorExit exception - needed by generator.close() -// This would belong to objgenerator.c, but to keep mp_obj_exception_t -// definition module-private so far, have it here. -const mp_obj_exception_t mp_const_GeneratorExit_obj = {{&mp_type_GeneratorExit}, 0, 0, NULL, (mp_obj_tuple_t*)&mp_const_empty_tuple_obj}; - void mp_obj_exception_print(const mp_print_t *print, mp_obj_t o_in, mp_print_kind_t kind) { mp_obj_exception_t *o = MP_OBJ_TO_PTR(o_in); mp_print_kind_t k = kind & ~PRINT_EXC_SUBCLASS; diff --git a/py/objgenerator.c b/py/objgenerator.c index b7186b8d0b..62e6446166 100644 --- a/py/objgenerator.c +++ b/py/objgenerator.c @@ -34,6 +34,9 @@ #include "py/objfun.h" #include "py/stackctrl.h" +// Instance of GeneratorExit exception - needed by generator.close() +const mp_obj_exception_t mp_const_GeneratorExit_obj = {{&mp_type_GeneratorExit}, 0, 0, NULL, (mp_obj_tuple_t*)&mp_const_empty_tuple_obj}; + /******************************************************************************/ /* generator wrapper */