Work around writable wchar_t* in Py_SetProgramName() pre 3.7
Fixes #94
Signed-off-by: Henner Zeller <h.zeller@acm.org>
diff --git a/src/API/PythonAPI.cpp b/src/API/PythonAPI.cpp
index 8896ffe..300ab52 100644
--- a/src/API/PythonAPI.cpp
+++ b/src/API/PythonAPI.cpp
@@ -201,7 +201,10 @@
}
}
}
- Py_SetProgramName(L"surelog"); /* optional but recommended */
+ // Before Python 3.7, the parameter to SetProgramName() was not a
+ // const wchar_t* but a wchar_t (even though never written to).
+ static wchar_t progname[] = L"surelog";
+ Py_SetProgramName(progname);
PyImport_AppendInittab("slapi", &PyInit_slapi);