[3.11] gh-104372: Cleanup _posixsubprocess make_inheritable for async signal safety gh-104518 (#104785)
Move all of the Python C API calls into the parent process up front
instead of doing PyLong_AsLong and PyErr_Occurred and PyTuple_GET from
the post-fork/vfork child process.
Much of this was long overdue. We shouldn't have been using PyTuple and
PyLong APIs within all of these low level functions anyways.
This is a backport of
c649df6 for #104518 and the tiny adjustment in
d1732fe #104697.
Backporting this allows backporting of the real bug fix that requires it.
Co-authored-by: Gregory P. Smith [Google] <greg@krypto.org>