From c16a971c0fe5980a2d6da23e7d3d6d917cb9dc67 Mon Sep 17 00:00:00 2001 From: David Shah Date: Fri, 8 Jun 2018 11:17:04 +0200 Subject: python: Fixing builds as importable module Signed-off-by: David Shah --- common/pybindings.cc | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'common/pybindings.cc') diff --git a/common/pybindings.cc b/common/pybindings.cc index 5c86720e..454a571c 100644 --- a/common/pybindings.cc +++ b/common/pybindings.cc @@ -113,6 +113,7 @@ static wchar_t *program; void init_python(const char *executable) { +#ifndef PYTHON_MODULE program = Py_DecodeLocale(executable, NULL); if (program == NULL) { fprintf(stderr, "Fatal error: cannot decode executable filename\n"); @@ -129,12 +130,15 @@ void init_python(const char *executable) std::string perror_str = parse_python_exception(); std::cout << "Error in Python: " << perror_str << std::endl; } +#endif } void deinit_python() { +#ifndef PYTHON_MODULE Py_Finalize(); PyMem_RawFree(program); +#endif } void execute_python_file(const char *python_file) -- cgit v1.2.3