[3.9] bpo-43710: Change layout of pystate struct to preserve intra-version ABI compatibiliy. by markshannon · Pull Request #25160 · python/cpython
This PR replaces the original (in 3.9.0)
char overflowed; char recursion_critical;
with
short recursion_headroom;
restoring the ABI broken by #24501
Since recursion_headroom, overflowed, and recursion_critical all serve the same purpose, indicating that RecursionError should not be raised unless overflow become excessive, we can safely merge them.
I choose to use short recursion_headroom rather than using char recursion_headroom and leaving recursion_critical in place, so that assignments to recursion_critical in code compiled for 3.9.0 will be visible as changes to recursion_headroom.
The layout will be the same (at least for all compilers where sizeof(short) == sizeof(char)*2).