fix const vs static generatorexit again

This commit is contained in:
Jeff Epler 2023-09-22 10:45:49 -05:00
parent e1fffe67a0
commit 6b5c7b6ce6
No known key found for this signature in database
GPG Key ID: D5BF15AB975AB4DE
4 changed files with 6 additions and 4 deletions

View File

@ -926,7 +926,9 @@ extern const struct _mp_obj_dict_t mp_const_empty_dict_obj;
extern const struct _mp_obj_singleton_t mp_const_ellipsis_obj;
extern const struct _mp_obj_traceback_t mp_const_empty_traceback_obj;
extern const struct _mp_obj_singleton_t mp_const_notimplemented_obj;
#if MICROPY_CONST_GENERATOREXIT_OBJ
extern const struct _mp_obj_exception_t mp_const_GeneratorExit_obj;
#endif
// Fixed empty map. Useful when calling keyword-receiving functions
// without any keywords from C, etc.

View File

@ -285,7 +285,7 @@ void mp_obj_exception_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest) {
if (dest[0] != MP_OBJ_NULL) {
// store/delete attribute
#if MICROPY_CONST_GENERATOREXIT_OBJ
if (self == &mp_static_GeneratorExit_obj) {
if (self == &mp_const_GeneratorExit_obj) {
mp_raise_AttributeError(MP_ERROR_TEXT("can't set attribute"));
}
#endif

View File

@ -39,7 +39,7 @@
// CIRCUITPY: https://github.com/adafruit/circuitpython/pull/7069 fix
#if MICROPY_CONST_GENERATOREXIT_OBJ
const
mp_obj_exception_t mp_static_GeneratorExit_obj = {{&mp_type_GeneratorExit}, (mp_obj_tuple_t *)&mp_const_empty_tuple_obj, (mp_obj_traceback_t *)&mp_const_empty_traceback_obj};
mp_obj_exception_t mp_const_GeneratorExit_obj = {{&mp_type_GeneratorExit}, (mp_obj_tuple_t *)&mp_const_empty_tuple_obj, (mp_obj_traceback_t *)&mp_const_empty_traceback_obj};
#else
static
mp_obj_exception_t mp_static_GeneratorExit_obj;
@ -397,7 +397,7 @@ static mp_obj_t generatorexit(void) {
MP_STATIC_ASSERT(!MICROPY_CONST_GENERATOREXIT_OBJ);
mp_obj_exception_initialize0(&mp_static_GeneratorExit_obj, &mp_type_GeneratorExit);
#endif
return MP_OBJ_FROM_PTR(&mp_static_GeneratorExit_obj);
return MP_OBJ_FROM_PTR(&mp_const_GeneratorExit_obj);
}
STATIC mp_obj_t gen_instance_close(mp_obj_t self_in) {

View File

@ -1441,7 +1441,7 @@ unwind_loop:
if ( true
// CIRCUITPY
#if MICROPY_CONST_GENERATOREXIT_OBJ
&& nlr.ret_val != &mp_static_GeneratorExit_obj
&& nlr.ret_val != &mp_const_GeneratorExit_obj
#endif
&& *code_state->ip != MP_BC_END_FINALLY
&& *code_state->ip != MP_BC_RAISE_LAST) {