From 804f26f18ea0c27de2bb7f36145b378c2a96f860 Mon Sep 17 00:00:00 2001 From: Francois Keith <keith@lirmm.fr> Date: Sat, 15 Mar 2014 00:51:14 +0100 Subject: [PATCH] Correct the PyRun_File use. Close the file once finished. Solves error pointed in previous commit. --- src/interpreter.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/interpreter.cc b/src/interpreter.cc index ba8930a..33ebe62 100644 --- a/src/interpreter.cc +++ b/src/interpreter.cc @@ -230,8 +230,8 @@ PyObject* Interpreter::globals() void Interpreter::runPythonFile( std::string filename ) { PyObject* pymainContext = globals_; - PyRun_File(fopen( filename.c_str(),"r" ), filename.c_str(), - Py_file_input, pymainContext,pymainContext); + PyRun_FileExFlags(fopen( filename.c_str(),"r" ), filename.c_str(), + Py_file_input, pymainContext,pymainContext, true, NULL); if (PyErr_Occurred()) { std::cout << "Error occures..." << std::endl; -- GitLab