[Python-Dev] USE_STACKCHECK and running out of stack

Ronald Oussoren ronaldoussoren at mac.com
Sat Jul 28 10:50:17 EDT 2018


I’m looking at PyOS_CheckStack because this feature might be useful on macOS (and when I created bpo-33955 for this someone ran with it and created a patch).

Does anyone remember why the interpreter raises MemoryError and not RecursionError when PyOS_CheckStack detects that we’re about to run out of stack space? 

The reason I’m looking into this is that the default stack size on macOS is fairly small and I’d like to avoid crashing the interpreter when running out of stackspace on threads created by the system (this is less of a risk on threads created by Python itself because we can arrange for a large enough stack in that case).


More information about the Python-Dev mailing list