[Boost-bugs] [Boost C++ Libraries] #8058: boost::python::exec_file not closing file descriptor with python 2.7

Subject: [Boost-bugs] [Boost C++ Libraries] #8058: boost::python::exec_file not closing file descriptor with python 2.7
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2013-02-14 05:15:58


#8058: boost::python::exec_file not closing file descriptor with python 2.7
--------------------------------+-------------------------------------------
 Reporter: shobhit87@… | Type: Bugs
   Status: new | Milestone: To Be Determined
Component: None | Version: Boost 1.47.0
 Severity: Problem | Keywords:
--------------------------------+-------------------------------------------
 I am trying to execute a python script in my c++ code using python2.7 and
 boost1.47.0

 Here is the code:
 {{{

 #include "boost/python.hpp"
 #include <iostream>

 int main(int argc, char** argv)
 {
     Py_Initialize();
     boost::python::object test = boost::python::import("__main__");
     boost::python::object testDict = test.attr("__dict__");
     while (1){
     try
     {
         boost::python::exec_file("test.py", testDict, testDict);
     }
     catch(boost::python::error_already_set& e)
     {
         PyErr_Print();
     }
     catch(std::exception const &exc)
     {
         std::cerr << exc.what();
         PyErr_Print();
         _exit(0);
     }
  }
 Py_Finalize();
 return 0;
 }
 }}}

 It is working fine with python2.4 and boost1.34.1(on both 32 bits and 64
 bits machine). But on 64 bit machine it is not closing the file descriptor
 with python2.7. After crossing the maximum FD limit(i.e. ulimit value) its
 crashing with the following error:

 test.py : no such fileIOError: [Errno 24] Too many open files: 'test.py'

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/8058>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:12 UTC