Mercurial > pytave
diff pyexec.cc @ 405:478d83448b0b
Refactor Python initialization into a common function
* oct-py-init.cc, oct-py-init.h: New files defining a pytave::py_init function.
* __py_struct_from_dict__.cc, pycall.cc, pyeval.cc, pyexec.cc: Use it instead
of initializing Python differently in each entry point.
* Makefile.am (COMMON_SOURCE_FILES): Include oct-py-init.cc in the list.
(PYTAVE_HEADER_FILES): Include oct-py-init.h in the list.
author | Mike Miller <mtmiller@octave.org> |
---|---|
date | Sat, 29 Apr 2017 15:43:42 -0700 |
parents | 3644df6564bc |
children | 16e79a1e96b8 |
line wrap: on
line diff
--- a/pyexec.cc Fri Apr 28 16:21:39 2017 -0700 +++ b/pyexec.cc Sat Apr 29 15:43:42 2017 -0700 @@ -30,10 +30,9 @@ #include <oct.h> -#define PYTAVE_DO_DECLARE_SYMBOL -#include "arrayobjectdefs.h" #include "exceptions.h" #include "oct-py-eval.h" +#include "oct-py-init.h" #include "oct-py-util.h" #include "python_to_octave.h" @@ -71,7 +70,7 @@ std::string code = args(0).string_value (); - Py_Initialize (); + pytave::py_init (); PyObject *local_namespace = nullptr; if (nargin > 1)