This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Investigate implementation of PyOS_CheckStack on OSX
Type: behavior Stage: resolved
Components: Interpreter Core, macOS Versions: Python 3.6
process
Status: closed Resolution: duplicate
Dependencies: Superseder: Implement PyOS_CheckStack on macOS using pthread_get_stack*_np
View: 33955
Assigned To: Nosy List: ned.deily, ronaldoussoren
Priority: low Keywords:

Created on 2015-10-30 16:12 by ronaldoussoren, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Messages (1)
msg253742 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2015-10-30 16:12
On OSX 10.4 or later the following functions are available:

size_t pthread_get_stacksize_np(pthread_t);
void* pthread_get_stackaddr_np(pthread_t);

These functions could be used to implement PyOS_CheckStack on OSX. The advantage of this would be that it would get less likely that recursion causes hard crashes when the recursion limit is not optimally tuned to the stack size on OSX. (Note that OSX has a fixed size stack for the main thread as well, AFAIK unlike linux).

The disadvantage of implementing this is that a naive implementation might have a negative performance impact. It should be possible to avoid this by caching the return values of these functions in the thread state.

Another disadvantage according to a quick search on Google: ``pthread_get_stacksize_np`` appears to be buggy on some OSX versions, which requires workarounds to get the right behavior.
History
Date User Action Args
2022-04-11 14:58:23adminsetgithub: 69704
2019-08-31 18:18:01ned.deilysetstatus: open -> closed
superseder: Implement PyOS_CheckStack on macOS using pthread_get_stack*_np
resolution: duplicate
stage: test needed -> resolved
2015-10-30 16:12:03ronaldoussorencreate