order and local zone tags, and elements in views.
- Fix #14: contrib/unbound.init: Fix wrong comparison judgment
before copying.
+ - Fix for python module on Windows, fix fopen.
25 February 2019: Wouter
- Fix #4227: pair event del and add for libevent for tcp_req_info.
PyObject* py_init_arg, *res;
PyGILState_STATE gil;
int init_standard = 1;
+#if PY_MAJOR_VERSION < 3
+ PyObject* PyFileObject = NULL;
+#endif
struct pythonmod_env* pe = (struct pythonmod_env*)calloc(1, sizeof(struct pythonmod_env));
if (!pe)
}
/* Check Python file load */
- if ((script_py = fopen(pe->fname, "r")) == NULL)
+ /* uses python to open the file, this works on other platforms,
+ * eg. Windows, to open the file in the correct mode for python */
+#if PY_MAJOR_VERSION < 3
+ PyObject* PyFileObject = PyFile_FromString(pe->fname, "r");
+ script_py = PyFile_AsFile(PyFileObject, pe->fname, 1);
+#else
+ script_py = _Py_fopen(pe->fname, "r");
+#endif
+ if (script_py == NULL)
{
log_err("pythonmod: can't open file %s for reading", pe->fname);
PyGILState_Release(gil);