-
-
Notifications
You must be signed in to change notification settings - Fork 8.2k
ports/unix: implement PEP 475 #5723
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
5f204d7
to
b3bad6a
Compare
99f377d
to
130061d
Compare
rebased on after #5769 |
Thanks for this, it's a good addition. I was just thinking if there could be a way to eliminate the duplication of code, all the very similar for-ever loops that keep going while there is EINTR. Possible ways to factor the code:
Macros and inline functions won't help to reduce code size, but probably a macro is the only way to do it without getting to messy. |
Some other points:
|
I've added a few commits for discussion. They can be squashed if all are acceptable. I made a macro
There was quite a variety of cases to cover with a single macro. I was able to get all but one without getting too crazy. I also made an intermediate commit with a |
Yes, we would need to use something like ptrace to intercept the system calls. e.g. https://nullprogram.com/blog/2018/06/23/ |
The unix coverage thread_stacksize1 test failure seems to be unrelated to this PR as I am getting the same failure locally without these changes. |
Thanks for updating. I think the |
ports/unix/mpconfigport.h
Outdated
MP_THREAD_GIL_ENTER(); \ | ||
(void)ret; \ | ||
} while (0) | ||
#endif |
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.
removal of this is a nice clean-up, can be done in a separate commit/PR
I went ahead and squashed the commits, keeping the Also I split out the cleanup as suggested in #5782, so it would be best to merge that first before merging this PR. |
https://www.python.org/dev/peps/pep-0475/ This implements something similar to PEP 475 on the unix port. There are a few differences from the CPython implementation: - Since we call mp_handle_pending(), addition functions could be called if MICROPY_ENABLE_SCHEDULER is enabled, not just signal handlers. - CPython only handles signal on the main thread, so other threads will raise InterruptedError instead of retrying. On MicroPython, mp_handle_pending() will currently raise exceptions on any thread. A new macro MP_HAL_RETRY_SYSCALL is introduced to reduce duplicated code and ensure that all instances behave the same. This will also allow other ports that use posix-like system calls to provide their own implementation if needed.
rebased to fix merge conflict |
Ok, merged in 9418611 |
traceback: fix for crash on non-native exceptions
https://www.python.org/dev/peps/pep-0475/
This implements something similar to PEP 475 on the unix port.
There are a few differences from the CPython implementation:
MICROPY_ENABLE_SCHEDULER
is enabled, not just signal handlers.InterruptedError
instead of retrying. On MicroPython,mp_handle_pending()
will currently raise exceptions on any thread.