From 2d16cca046ff80f2be3eea6934dd1dd8f4b807d1 Mon Sep 17 00:00:00 2001 From: Cyrille Bagard Date: Mon, 25 May 2020 22:36:02 +0200 Subject: Been more verbose on Python loading failures. --- plugins/pychrysalide/pychrysa.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/plugins/pychrysalide/pychrysa.c b/plugins/pychrysalide/pychrysa.c index df6cc9a..96d61ae 100644 --- a/plugins/pychrysalide/pychrysa.c +++ b/plugins/pychrysalide/pychrysa.c @@ -486,21 +486,21 @@ PyMODINIT_FUNC PyInit_pychrysalide(void) } if (!is_current_abi_suitable()) - return NULL; + goto exit; if (pygobject_init(-1, -1, -1) == NULL) { PyErr_SetString(PyExc_SystemError, "unable to init GObject in Python."); - return NULL; + goto exit; } if (!set_version_for_gtk_namespace("3.0")) - return NULL; + goto exit; if (!load_all_basic_components()) { PyErr_SetString(PyExc_SystemError, "unable to load all basic components."); - return NULL; + goto exit; } /* Mise en place des fonctionnalités offertes */ @@ -545,7 +545,9 @@ PyMODINIT_FUNC PyInit_pychrysalide(void) if (!status) { PyErr_SetString(PyExc_SystemError, "failed to load all PyChrysalide components."); - return NULL; + Py_DECREF(result); + result = NULL; + goto exit; } if (_standalone) @@ -555,7 +557,9 @@ PyMODINIT_FUNC PyInit_pychrysalide(void) if (ret == -1) { PyErr_SetString(PyExc_SystemError, "failed to register a cleanup function."); - return NULL; + Py_DECREF(result); + result = NULL; + goto exit; } /** @@ -595,6 +599,11 @@ PyMODINIT_FUNC PyInit_pychrysalide(void) } + exit: + + if (result == NULL && !_standalone) + log_pychrysalide_exception("Loading failed"); + return result; } -- cgit v0.11.2-87-g4458