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

Merge branch 'develop'

This commit is contained in:
Stefan Seefeld
2015-06-30 08:46:41 -04:00
62 changed files with 74 additions and 1120 deletions

View File

@@ -84,9 +84,8 @@ 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);
// Let python open the file to avoid potential binary incompatibilities.
#if PY_VERSION_HEX >= 0x03400000
#if PY_VERSION_HEX >= 0x03040000
FILE *fs = _Py_fopen(f, "r");
#elif PY_VERSION_HEX >= 0x03000000
PyObject *fo = Py_BuildValue("s", f);
@@ -98,13 +97,10 @@ object BOOST_PYTHON_DECL exec_file(str filename, object global, object local)
python::handle<> file(pyfile);
FILE *fs = PyFile_AsFile(file.get());
#endif
int closeit = 1; // Close file before PyRun returns
PyObject* result = PyRun_FileEx(fs,
PyObject* result = PyRun_File(fs,
f,
Py_file_input,
global.ptr(), local.ptr(),
closeit);
global.ptr(), local.ptr());
if (!result) throw_error_already_set();
return object(detail::new_reference(result));
}