Skip to content

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

Merged
merged 11 commits into from
Jun 23, 2020
Merged

Issue #2865 -Clean up after ctrl-c interrupt in sleep #3043

merged 11 commits into from
Jun 23, 2020

Conversation

DavePutz
Copy link
Collaborator

@DavePutz DavePutz commented Jun 16, 2020

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.

Copy link
Member

@tannewt tannewt left a 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.

@DavePutz
Copy link
Collaborator Author

DavePutz commented Jun 17, 2020 via email

@tannewt
Copy link
Member

tannewt commented Jun 17, 2020

After sleep exits is the whole code.py stopped with a backtrace?

@DavePutz
Copy link
Collaborator Author

DavePutz commented Jun 17, 2020 via email

@tannewt
Copy link
Member

tannewt commented Jun 18, 2020

Well bummer! It should return a traceback like Python does:

Python 3.7.6 (default, Dec 30 2019, 19:38:26)
[Clang 11.0.0 (clang-1100.0.33.16)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import time
>>> time.sleep(10)
^CTraceback (most recent call last):
  File "<stdin>", line 1, in <module>
KeyboardInterrupt```

Maybe it's related to this? https://github.com/adafruit/circuitpython/blob/main/lib/utils/interrupt_char.c#L36

@DavePutz
Copy link
Collaborator Author

@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.

DavePutz added 2 commits June 19, 2020 19:00
Added code in mp_hal_delay_ms() to generate stacktrace and reset exception for ctrl-c interrupt
Copy link
Member

@tannewt tannewt left a 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 !

Copy link
Member

@tannewt tannewt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @DavePutz !

@tannewt tannewt merged commit 741e1d9 into adafruit:main Jun 23, 2020
@DavePutz DavePutz deleted the Issue-2865 branch June 23, 2020 18:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants