Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cmake/version.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
# Pour la bibliothèque QtPython :
set (QT_PYTHON_MAJOR_VERSION "6")
set (QT_PYTHON_MINOR_VERSION "4")
set (QT_PYTHON_RELEASE_VERSION "3")
set (QT_PYTHON_RELEASE_VERSION "4")
set (QT_PYTHON_VERSION ${QT_PYTHON_MAJOR_VERSION}.${QT_PYTHON_MINOR_VERSION}.${QT_PYTHON_RELEASE_VERSION})

# Pour la bibliothèque QtPython3 :
set (QT_PYTHON_3_MAJOR_VERSION "6")
set (QT_PYTHON_3_MINOR_VERSION "4")
set (QT_PYTHON_3_RELEASE_VERSION "3")
set (QT_PYTHON_3_RELEASE_VERSION "4")
set (QT_PYTHON_3_VERSION ${QT_PYTHON_3_MAJOR_VERSION}.${QT_PYTHON_3_MINOR_VERSION}.${QT_PYTHON_3_RELEASE_VERSION})

20 changes: 17 additions & 3 deletions src/QtPython3/QtPython.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,9 +190,23 @@ QtPython::~QtPython ( )

void QtPython::preInitialize ( ) // CP v 5.1.0
{
// A faire avant Py_Initialize :
if (-1 == PyImport_AppendInittab ("redirector", PyInit_redirector))
throw Exception ("Echec de l'importation du module redirector par la console Python.");
static bool preInitialized = false; // v 6.4.4

if (false == preInitialized)
{
// A faire avant Py_Initialize :
if (false == Py_IsInitialized ( ))
{
if (-1 == PyImport_AppendInittab ("redirector", PyInit_redirector))
throw Exception ("Echec de l'importation du module redirector par la console Python.");
}
else
// v 6.4.4. Eviter (python 3.12.5) : Fatal Python error: PyImport_AppendInittab: PyImport_AppendInittab() may not be called after Py_Initialize()
// Python runtime state: initialized
throw Exception ("QtPython::preInitialize doit être appelé avant Py_Initialize. PyImport_AppendInittab non appelé car l'application planterait. La console python ne devrait pas fonctionner correctement.");

preInitialized = true;
} // if (false == preInitialized)
} // QtPython::preInitialize


Expand Down
6 changes: 6 additions & 0 deletions versions.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
Version 6.4.4 : 20/11/24
===============

QtPython::preInitialize l�ve une exception si appel�e pour la premi�re fois apr�s Py_Initialize en vue d'�viter un fatal error de python 3.


Version 6.4.3 : 04/10/24
===============

Expand Down