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,11 @@ PythonPlugin::PythonPlugin(struct _inittab *inittab) :
293293 abs_path(0 ),
294294 log_level(0 )
295295{
296+ PyConfig config;
297+ PyConfig_InitPythonConfig (&config);
296298 if (abs_path) {
297299 wchar_t *program = Py_DecodeLocale (abs_path, NULL );
298- Py_SetProgramName ( program);
300+ PyConfig_SetString (&config, &config. program_name , program);
299301 }
300302 if (inittab != NULL ) {
301303 if (!Py_IsInitialized ()) {
@@ -323,8 +325,9 @@ PythonPlugin::PythonPlugin(struct _inittab *inittab) :
323325 }
324326 }
325327 }
326- Py_UnbufferedStdioFlag = 1 ;
327- Py_Initialize ();
328+ config.buffered_stdio = 0 ;
329+ Py_InitializeFromConfig (&config);
330+ PyConfig_Clear (&config);
328331 initialize ();
329332}
330333
@@ -392,7 +395,7 @@ int PythonPlugin::configure(const char *iniFilename,
392395 log_level = atoi (inistring);
393396 else log_level = 0 ;
394397
395- char pycmd[PATH_MAX];
398+ char pycmd[PATH_MAX + 64 ];
396399 int n = 1 ;
397400 int lineno;
398401 while (NULL != (inistring = inifile.Find (" PATH_PREPEND" , " PYTHON" ,
Original file line number Diff line number Diff line change @@ -208,8 +208,12 @@ 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- Py_SetProgramName (wname );
212- Py_Initialize ();
211+ PyConfig config ;
212+ PyConfig_InitPythonConfig (& config );
213+ PyConfig_SetString (& config , & config .program_name , wname );
214+ Py_InitializeFromConfig (& config );
215+ PyConfig_Clear (& config );
216+
213217 PyRun_SimpleString ("import pyui\n"
214218 "pyui.instance = pyui.master.keyboard()\n"
215219 "pyui.exit_funct = pyui.instance.exit\n"
You can’t perform that action at this time.
0 commit comments