gh-155905: Fix error handling in _testcapi helpers (GH-155906)
Py_fopen() sets an exception and returns NULL on error. The
pyobject_print*() helpers did not check the result and crashed, and the
pymarshal_*() helpers set a second exception on top of it.
The pyobject_print*() helpers which take a single argument now use
METH_O, and the result of PyUnicode_FromString() is now checked.
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>