Skip to content
This repository was archived by the owner on Jun 25, 2020. It is now read-only.
Merged
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
13 changes: 12 additions & 1 deletion src/python_interpreter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,17 @@
#include "menu.h"
#include "directories.h"

static wchar_t* DecodeLocale(const char* arg, size_t *size)
{
#ifndef PY_VERSION_HEX
#error Python not included
#elif PY_VERSION_HEX < 0x03050000
return _Py_char2wchar(arg, size);
#else
return Py_DecodeLocale(arg, size);
#endif
}

inline pybind11::module pyobject_from_gobj(gpointer ptr){
auto obj=G_OBJECT(ptr);
if(obj)
Expand Down Expand Up @@ -70,7 +81,7 @@ Python::Interpreter::Interpreter(){
add_path(Config::get().python.site_packages);
add_path(plugin_path);
Py_Initialize();
argv=Py_DecodeLocale("",&size);
argv=DecodeLocale("",&size);
PySys_SetArgv(0,&argv);
auto sys=get_loaded_module("sys");
auto exc_func=[](pybind11::object type,pybind11::object value,pybind11::object traceback){
Expand Down