2
0
mirror of https://github.com/boostorg/python.git synced 2026-01-19 16:32:16 +00:00

Compare commits

...

7 Commits

Author SHA1 Message Date
Stefan Seefeld
e1e9eb303a Merge pull request #13 from ax3l/fix-missingPlaceholderInclude
Fix Trac #10932 Missing Include: Bind Placeholders
2015-03-26 09:16:15 -04:00
Stefan Seefeld
9eee9ef461 Merge pull request #15 from mmatrosov/master
Fix #11100 and #8058: binary compatibility and leaked file handle in exec_file()
2015-03-26 08:23:15 -04:00
Mikhail Matrosov
fe24ab9dd5 [#8058] Close file handle before exec_file() routine returns. 2015-03-11 01:11:54 +03:00
Mikhail Matrosov
a911c17fd6 [#11100] Fix binary incompatibilities with fopen() in exec_file() routine. 2015-03-11 01:11:54 +03:00
Daniel James
8d5d777ebb Add metadata file. 2015-01-25 21:25:23 +02:00
Axel Huebl
17a7655c74 Fix Missing Include: Bind Placeholders
boost/python/exception_translator.hpp(22): error: identifier "_1" is undefined
boost/python/exception_translator.hpp(22): error: identifier "_2" is undefined
2015-01-14 16:02:23 +01:00
Beman Dawes
832a1edd79 Merge 86392 from trunk. The spirit change was not applied because the file is not present in branches/release.
[SVN r86489]
2013-10-27 21:10:04 +00:00
6 changed files with 36 additions and 10 deletions

5
example/Jamroot Executable file → Normal file
View File

@@ -11,7 +11,10 @@ use-project boost
# boost_python library from the project whose global ID is
# /boost/python.
project
: requirements <library>/boost/python//boost_python ;
: requirements <library>/boost/python//boost_python
<implicit-dependency>/boost//headers
: usage-requirements <implicit-dependency>/boost//headers
;
# Declare the three extension modules. You can specify multiple
# source files after the colon separated by spaces.

2
example/quickstart/Jamroot Executable file → Normal file
View File

@@ -12,6 +12,8 @@ use-project boost
# /boost/python.
project boost-python-quickstart
: requirements <library>/boost/python//boost_python
<implicit-dependency>/boost//headers
: usage-requirements <implicit-dependency>/boost//headers
;
# Make the definition of the python-extension rule available

View File

@@ -20,7 +20,10 @@ use-project boost
# boost_python library from the project whose global ID is
# /boost/python.
project
: requirements <library>/boost/python//boost_python ;
: requirements <library>/boost/python//boost_python
<implicit-dependency>/boost//headers
: usage-requirements <implicit-dependency>/boost//headers
;
# Declare the three extension modules. You can specify multiple
# source files after the colon separated by spaces.

View File

@@ -8,6 +8,7 @@
# include <boost/python/detail/prefix.hpp>
# include <boost/bind.hpp>
# include <boost/bind/placeholders.hpp>
# include <boost/type.hpp>
# include <boost/python/detail/translate_exception.hpp>
# include <boost/python/detail/exception_handler.hpp>

15
meta/libraries.json Normal file
View File

@@ -0,0 +1,15 @@
{
"key": "python",
"name": "Python",
"authors": [
"Dave Abrahams"
],
"description": "The Boost Python Library is a framework for interfacing Python and C++. It allows you to quickly and seamlessly expose C++ classes functions and objects to Python, and vice-versa, using no special tools -- just your C++ compiler.",
"category": [
"Inter-language"
],
"maintainers": [
"Ralf Grosse-Kunstleve <rwgrosse-kunstleve -at- lbl.gov>",
"Ravi Rajagopal <lists_ravi -at- lavabit.com>"
]
}

View File

@@ -84,22 +84,24 @@ object BOOST_PYTHON_DECL exec_file(str filename, object global, object local)
if (local.is_none()) local = global;
// should be 'char const *' but older python versions don't use 'const' yet.
char *f = python::extract<char *>(filename);
#if PY_VERSION_HEX >= 0x03000000
// TODO(bhy) temporary workaround for Python 3.
// should figure out a way to avoid binary incompatibilities as the Python 2
// version did.
FILE *fs = fopen(f, "r");
#else
// Let python open the file to avoid potential binary incompatibilities.
#if PY_VERSION_HEX >= 0x03000000
// See http://www.codeproject.com/Articles/820116/Embedding-Python-program-in-a-C-Cplusplus-code
FILE *fs = _Py_fopen(f, "r");
#else
PyObject *pyfile = PyFile_FromString(f, const_cast<char*>("r"));
if (!pyfile) throw std::invalid_argument(std::string(f) + " : no such file");
python::handle<> file(pyfile);
FILE *fs = PyFile_AsFile(file.get());
#endif
PyObject* result = PyRun_File(fs,
int closeit = 1; // Close file before PyRun returns
PyObject* result = PyRun_FileEx(fs,
f,
Py_file_input,
global.ptr(), local.ptr());
global.ptr(), local.ptr(),
closeit);
if (!result) throw_error_already_set();
return object(detail::new_reference(result));
}