-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Fix for Issue #2689 #3312
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix for Issue #2689 #3312
Conversation
update from main
update from main
Update from main
Pull from adafruit main
Merge from adafruit main
[I had trouble adding the related issue to Linked Issues, until I edited it into the description of this PR] |
Hello, and thanks! I'd like to understand a bit better what is happening here, so please bear with me. When ctrl-c is pressed and this bug occurs, I assume that (on serial) it just prints the ">>>" prompt, and not an exception? (in contrast to the interruption of a long-running calculation, say) What type/value does mp_pending_exception have when this code is reached? Superficially, it looks like just after the call to
Should mp_hal_stdin_rx_chr have a catch-all for any (non-NULL) exception? I didn't find any place where an unanticipated exception was stored...
I think this is important in understanding whether the correct solution is to suppress the exception here, rather than determining why it is not handled in |
Tests show that the pending exception is, in fact, an mp_kbd_exception. The code quoted is in mp_hal_delay_ms(), and there are no |
I appear to have pasted alternate-universe contents of Specifically, I appear to have been referring to a branch I haven't pushed, which was intended to fix the problem that during a call to input() or stdin.read(), ctrl-c did not raise a KeyboardInterrupt until some other char is pressed. I wrote the code I pasted and haven't gotten around to testing it. |
@@ -473,6 +473,9 @@ void readline_init(vstr_t *line, const char *prompt) { | |||
#if MICROPY_REPL_AUTO_INDENT | |||
readline_auto_indent(); | |||
#endif | |||
// make sure pending exceptions are cleared | |||
MP_STATE_VM(mp_pending_exception) = MP_OBJ_NULL; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure I'd do this here. The VM should be handling every pending exception to print the traceback or clear it silently. Is there an exit from somewhere that could clear it instead?
Fixed by PR #3318. Closing. |
When hitting CTRL-C during the long output described in issue #2689 the pending exception was never being cleared.
As a result; in displayio_background() the call to mp_hal_is_interrupted() would always return true and the displayio screen would stop being updated. This patch simply clears any pending exceptions when readline_init() is called (i.e. when the REPL prompt is being printed).
Closes: #2689