source/bases/Win32GUI.c
//-----------------------------------------------------------------------------
// HandleSystemExitException()
//   Handles a system exit exception differently. If an integer value is passed
// through then that becomes the exit value; otherwise the string value of the
// value passed through is displayed in a message box.
//-----------------------------------------------------------------------------
HandleSystemExitException()
Handles a system exit exception differently. If an integer value is passed
through then that becomes the exit value; otherwise the string value of the
value passed through is displayed in a message box.
HandleSystemExitException () Handles a system exit exception differently . If an integer value is passed through then that becomes the exit value ; otherwise the string value of the value passed through is displayed in a message box .
static int HandleSystemExitException()
{
    PyObject *caption, *message, *type, *value, *traceback, *code;
    int exitCode = 0;
    PyErr_Fetch(&type, &value, &traceback);
    PyErr_NormalizeException(&type, &value, &traceback);
    caption = PyObject_GetAttrString(value, "caption");
    if (!caption || !PyUnicode_Check(caption)) {
        PyErr_Clear();
        caption = PyUnicode_FromString("cx_Freeze: Application Terminated");
        if (!caption)
            return FatalError("Cannot create caption string object.");
    }
    code = PyObject_GetAttrString(value, "code");
    if (!code)
        PyErr_Clear();
    else {
        value = code;
        if (value == Py_None)
            Py_Exit(0);
    }
    if (PyLong_Check(value))
        exitCode = PyLong_AsLong(value);
    else {
        message = PyObject_Str(value);
        if (!message)
            return FatalError("Cannot get string representation of messsage.");
        DisplayMessageFromPythonObjects(caption, message);
        exitCode = 1;
    }
    Py_Exit(exitCode);
    return -1;
}
static int HandleSystemExitException ( ) { PyObject * caption , * message , * type , * value , * traceback , * code ; int exitCode = 0 ; PyErr_Fetch ( & type , & value , & traceback ) ; PyErr_NormalizeException ( & type , & value , & traceback ) ; caption = PyObject_GetAttrString ( value , " " ) ; if ( ! caption || ! PyUnicode_Check ( caption ) ) { PyErr_Clear ( ) ; caption = PyUnicode_FromString ( " " ) ; if ( ! caption ) return FatalError ( " " ) ; } code = PyObject_GetAttrString ( value , " " ) ; if ( ! code ) PyErr_Clear ( ) ; else { value = code ; if ( value == Py_None ) Py_Exit ( 0 ) ; } if ( PyLong_Check ( value ) ) exitCode = PyLong_AsLong ( value ) ; else { message = PyObject_Str ( value ) ; if ( ! message ) return FatalError ( " " ) ; DisplayMessageFromPythonObjects ( caption , message ) ; exitCode = 1 ; } Py_Exit ( exitCode ) ; return -1 ; }
HandleSystemExitException()
Handles a system exit exception differently.
HandleSystemExitException () Handles a system exit exception differently .