Skip to content

Commit

Permalink
initialize embedded python to UTF-8 mode (fixes #43834)
Browse files Browse the repository at this point in the history
(cherry picked from commit 61c7973)
  • Loading branch information
jef-n committed Jun 24, 2021
1 parent f213887 commit 2f778dc
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/python/qgspythonutilsimpl.cpp
Expand Up @@ -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
Expand Down

2 comments on commit 2f778dc

@agiudiceandrea
Copy link
Contributor

@agiudiceandrea agiudiceandrea commented on 2f778dc Jun 24, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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
Copy link
Member Author

@jef-n jef-n commented on 2f778dc Jun 24, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The next nightly will tell.

Please sign in to comment.