- bool doSave = wxPyRestoreThread();
- PyObject* list = PyList_New(0);
- for (size_t i=0; i<filenames.GetCount(); i++) {
- PyObject* str = PyString_FromString(filenames[i].c_str());
- PyList_Append(list, str);
- }
+ wxPyTState* state = wxPyBeginBlockThreads();
+ PyObject* list = wxArrayString2PyList_helper(filenames);