This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: import_spam() in extending python can fail without setting the error.
Type: crash Stage:
Components: Documentation Versions: Python 2.6
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: georg.brandl Nosy List: georg.brandl, jak
Priority: normal Keywords:

Created on 2009-07-09 11:31 by jak, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (2)
msg90325 - (view) Author: Julian Andres Klode (jak) Date: 2009-07-09 11:31
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.
msg90409 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2009-07-11 10:15
Thanks, fixed in r73938.
History
Date User Action Args
2022-04-11 14:56:50adminsetgithub: 50695
2009-07-11 10:15:09georg.brandlsetstatus: open -> closed
resolution: fixed
messages: + msg90409
2009-07-09 11:31:47jakcreate