diff --git a/src/interpreter.cc b/src/interpreter.cc index 33ebe6233ced9bd6a2225219641eae1864820356..9f1e2e5af08afa5f154a9236bf462ddb9847109a 100644 --- a/src/interpreter.cc +++ b/src/interpreter.cc @@ -230,13 +230,14 @@ PyObject* Interpreter::globals() void Interpreter::runPythonFile( std::string filename ) { PyObject* pymainContext = globals_; - PyRun_FileExFlags(fopen( filename.c_str(),"r" ), filename.c_str(), + PyObject* run = 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; PyErr_Print(); } + Py_DecRef(run); } void Interpreter::runMain( void )