Issue 6446: import_spam() in extending python can fail without setting the error.
The given example function initspam fails if an
Based on some experience with my own code, I have found out that the
function import_spam() fails when the module is not importable. In this
case, it returns 0, although it should return -1 when an error occurs.
This causes a standalone program to crash if it has a main() function like:
Py_Initialize();
if (import_spam() < 0) {
Py_Finalize();
return 1;
}
Py_Finalize();
The function should return -1, so we can know there is an error and are
able to handle it.