[issue25518] Investigate implementation of PyOS_CheckStack on OSX

Ronald Oussoren report at bugs.python.org
Fri Oct 30 12:12:03 EDT 2015


New submission from Ronald Oussoren:

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.

----------
components: Interpreter Core, Macintosh
messages: 253742
nosy: ned.deily, ronaldoussoren
priority: low
severity: normal
stage: test needed
status: open
title: Investigate implementation of PyOS_CheckStack on OSX
type: behavior
versions: Python 3.6

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue25518>
_______________________________________


More information about the Python-bugs-list mailing list