From cffe54db68aa023fca52a0b0ddb8a0f20a710f57 Mon Sep 17 00:00:00 2001 From: nicolas le goff Date: Tue, 27 Aug 2024 15:31:30 +0200 Subject: [PATCH] changed position of Py_DecRef to after object no longer used --- src/QtPython3/QtPythonConsole.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/QtPython3/QtPythonConsole.cpp b/src/QtPython3/QtPythonConsole.cpp index cd00889..eb7628b 100644 --- a/src/QtPython3/QtPythonConsole.cpp +++ b/src/QtPython3/QtPythonConsole.cpp @@ -655,8 +655,8 @@ static int tracePythonExecution (PyObject*, PyFrameObject* frame, int what, PyOb else if (PyTrace_EXCEPTION == what) // Ligne en erreur { PyObject* pystring = PyObject_Str (obj); - Py_DecRef (pystring); const string error= PyUnicode_AsUTF8 (pystring); + Py_DecRef (pystring); QtPythonConsole &console = getConsole (*frame); console.lineProcessedCallback (PyUnicode_AsUTF8 (frame->f_code->co_filename), PyFrame_GetLineNumber (frame), false, error); } // if (PyTrace_EXCEPTION == what)