-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Issue #2865 -Clean up after ctrl-c interrupt in sleep #3043
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
Conversation
update from adafruit
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 don't think this is right because it would prevent the keyboard exception from being raised and stopping the code.
This fix does not stop the ctrl-c exception from being handled - the
exception is noticed in
mp_hal_delay_ms() as we are looping and counting ticks, where it causes an
immediate exit
from the function. Testing shows that with this pull request change sleep()
is still interruptible
with a ctrl-c. Hope this helps,
-Dave
…On Wed, Jun 17, 2020 at 11:26 AM Scott Shawcroft ***@***.***> wrote:
***@***.**** requested changes on this pull request.
I don't think this is right because it would prevent the keyboard
exception from being raised and stopping the code.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#3043 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AFNJKEQKTAHRBTJKGUB3DK3RXDVBRANCNFSM4N76K6DQ>
.
|
After sleep exits is the whole code.py stopped with a backtrace? |
No, there is no backtrace. Current incorrect behavior also does not stop
the whole
code.py or generate a backtrace when a sleep() is interrupted with a
ctrl-c.
It just makes subsequent sleep() calls return immediately. Do I need a
call to mp_obj_print_exception() or some other function to generate a
trace? Thanks!
-Dave
…On Wed, Jun 17, 2020 at 12:54 PM Scott Shawcroft ***@***.***> wrote:
After sleep exits is the whole code.py stopped with a backtrace?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#3043 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AFNJKESTEKTKWCR67IGTB23RXD7L5ANCNFSM4N76K6DQ>
.
|
Well bummer! It should return a traceback like Python does:
|
@tannewt , I think I've solved the issue of a backtrace. CTRL-C during sleep() now both prints a backtrace and exits the running script. |
Added code in mp_hal_delay_ms() to generate stacktrace and reset exception for ctrl-c interrupt
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.
Thanks for the quick follow ups @DavePutz !
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.
Thank you @DavePutz !
Issue #2865 After exiting mp_hal_delay_ms() a check is needed to reset a ctrl-c keyboard exception; otherwise subsequent sleep() calls will return immediately.