File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -293,9 +293,17 @@ PythonPlugin::PythonPlugin(struct _inittab *inittab) :
293293 abs_path(0 ),
294294 log_level(0 )
295295{
296+ #if PY_VERSION_HEX >= 0x030800f0
297+ PyConfig config;
298+ PyConfig_InitPythonConfig (&config);
299+ #endif
296300 if (abs_path) {
297301 wchar_t *program = Py_DecodeLocale (abs_path, NULL );
302+ #if PY_VERSION_HEX >= 0x030800f0
303+ PyConfig_SetString (&config, &config.program_name , program);
304+ #else
298305 Py_SetProgramName (program);
306+ #endif
299307 }
300308 if (inittab != NULL ) {
301309 if (!Py_IsInitialized ()) {
@@ -323,8 +331,14 @@ PythonPlugin::PythonPlugin(struct _inittab *inittab) :
323331 }
324332 }
325333 }
334+ #if PY_VERSION_HEX >= 0x030800f0
335+ config.buffered_stdio = 0 ;
336+ Py_InitializeFromConfig (&config);
337+ PyConfig_Clear (&config);
338+ #else
326339 Py_UnbufferedStdioFlag = 1 ;
327340 Py_Initialize ();
341+ #endif
328342 initialize ();
329343}
330344
@@ -392,7 +406,7 @@ int PythonPlugin::configure(const char *iniFilename,
392406 log_level = atoi (inistring);
393407 else log_level = 0 ;
394408
395- char pycmd[PATH_MAX];
409+ char pycmd[PATH_MAX + 64 ];
396410 int n = 1 ;
397411 int lineno;
398412 while (NULL != (inistring = inifile.Find (" PATH_PREPEND" , " PYTHON" ,
Original file line number Diff line number Diff line change @@ -208,8 +208,16 @@ int main(int argc, char **argv)
208208 PyObject * pModule , * pFunc , * pPeriodicFunc , * pClass ;
209209 char name [] = "panelui" ;
210210 wchar_t * wname = Py_DecodeLocale (name , NULL );
211+ #if PY_VERSION_HEX >= 0x030800f0
212+ PyConfig config ;
213+ PyConfig_InitPythonConfig (& config );
214+ PyConfig_SetString (& config , & config .program_name , wname );
215+ Py_InitializeFromConfig (& config );
216+ PyConfig_Clear (& config );
217+ #else
211218 Py_SetProgramName (wname );
212219 Py_Initialize ();
220+ #endif
213221 PyRun_SimpleString ("import pyui\n"
214222 "pyui.instance = pyui.master.keyboard()\n"
215223 "pyui.exit_funct = pyui.instance.exit\n"
You can’t perform that action at this time.
0 commit comments