Ticket #51620: patch-no-abort-on-python-errors.diff

File patch-no-abort-on-python-errors.diff, 1.4 KB (added by RJVB (René Bertin), 8 years ago)
  • qpycore_public_api.cpp

    old new  
    2929#include "qpycore_types.h"
    3030
    3131
    32 // A replacement for PyErr_Print() that passes the exception to qFatal().
     32// A replacement for PyErr_Print() that passes the exception to qCritical().
    3333void pyqt5_err_print()
    3434{
    3535#if PY_MAJOR_VERSION >= 3
     
    113113        PyErr_Restore(exception, value, traceback);
    114114        PyErr_Print();
    115115
    116         // This will be passed to qFatal() if we can't get the detailed text.
     116        // This will be passed to qCritical() if we can't get the detailed text.
    117117        QByteArray message("Unhandled Python exception");
    118118
    119119        // Extract the detailed text if it was redirected.
     
    128128
    129129            if (text)
    130130            {
    131                 // Strip the text as qFatal() likes to add a newline.
     131                // Strip the text as qCritical() likes to add a newline.
    132132                PyObject *stripped = PyObject_CallMethod(text,
    133133                        CONST_CAST("strip"), NULL);
    134134
     
    186186            Py_DECREF(new_stderr);
    187187        }
    188188
    189         // qFatal() may not call abort.
     189        // qCritical() will not call abort.
    190190        Py_BEGIN_ALLOW_THREADS
    191         qFatal("%s", message.data());
     191        qCritical("%s", message.data());
    192192        Py_END_ALLOW_THREADS
    193193    }
    194194}