File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3333
3434#if MICROPY_HELPER_REPL
3535
36+ // CIRCUITPY-CHANGE: Disable warnings during autocomplete.
37+ #if CIRCUITPY_WARNINGS
38+ #include "shared-bindings/warnings/__init__.h"
39+ #endif
40+
3641#if MICROPY_PY_SYS_PS1_PS2
3742const char * mp_repl_get_psx (unsigned int entry ) {
3843 if (mp_obj_is_str (MP_STATE_VM (sys_mutable )[entry ])) {
@@ -158,7 +163,21 @@ STATIC bool test_qstr(mp_obj_t obj, qstr name) {
158163 if (obj ) {
159164 // try object member
160165 mp_obj_t dest [2 ];
166+
167+ // CIRCUITPY-CHANGE: Disable warnings during autocomplete. test_qstr()
168+ // pretends to load every qstr from a module and it can trigger warnings
169+ // meant to happen when user code imports them. So, save warning state and
170+ // restore it once we've found matching completions.
171+ #if CIRCUITPY_WARNINGS
172+ warnings_action_t current_action = MP_STATE_THREAD (warnings_action );
173+ MP_STATE_THREAD (warnings_action ) = WARNINGS_IGNORE ;
174+ #endif
175+
161176 mp_load_method_protected (obj , name , dest , true);
177+
178+ #if CIRCUITPY_WARNINGS
179+ MP_STATE_THREAD (warnings_action ) = current_action ;
180+ #endif
162181 return dest [0 ] != MP_OBJ_NULL ;
163182 } else {
164183 // try builtin module
You can’t perform that action at this time.
0 commit comments