Opened 10 years ago
Closed 8 years ago
#8058 closed Bugs (fixed)
boost::python::exec_file not closing file descriptor with python 2.7
Reported by: | Owned by: | Stefan Seefeld | |
---|---|---|---|
Milestone: | To Be Determined | Component: | python USE GITHUB |
Version: | Boost 1.47.0 | Severity: | Problem |
Keywords: | Cc: |
Description
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'
Change History (4)
comment:1 by , 10 years ago
Component: | None → Python |
---|---|
Owner: | set to |
comment:2 by , 8 years ago
comment:3 by , 8 years ago
Owner: | changed from | to
---|
comment:4 by , 8 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
Fixed in pull request #15 (cannot attach a link :-/ )