Skip to content
Permalink
Browse files
initialize embedded python to UTF-8 mode (fixes #43834)
(cherry picked from commit 61c7973)
  • Loading branch information
jef-n committed Jun 24, 2021
1 parent f213887 commit 2f778dc5373ecfc5aced3be2c1cdec34d8220876
Showing with 12 additions and 0 deletions.
  1. +12 −0 src/python/qgspythonutilsimpl.cpp
@@ -154,6 +154,18 @@ bool QgsPythonUtilsImpl::checkSystemImports()

void QgsPythonUtilsImpl::init()
{
PyStatus status;
PyPreConfig preconfig;
PyPreConfig_InitPythonConfig( &preconfig );

preconfig.utf8_mode = 1;

status = Py_PreInitialize( &preconfig );
if ( PyStatus_Exception( status ) )
{
Py_ExitStatusException( status );
}

// initialize python
Py_Initialize();
// initialize threading AND acquire GIL

2 comments on commit 2f778dc

@agiudiceandrea

This comment has been minimized.

Copy link
Contributor

@agiudiceandrea agiudiceandrea replied Jun 24, 2021

@jef-n will LTR build without issues also on systems (like Ubuntu 18.04 LTS Bionic or Debian 10 Buster or Windows old OSGeo4W repository) that ship python3 < 3.8?

@jef-n

This comment has been minimized.

Copy link
Member Author

@jef-n jef-n replied Jun 24, 2021

The next nightly will tell.

Please sign in to comment.