mirror of
https://github.com/boostorg/python.git
synced 2026-01-25 18:32:24 +00:00
Merge pull request #19 from Lastique/patch-1
Fix compilation with python 3.0-3.3
This commit is contained in:
@@ -84,11 +84,12 @@ 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.
|
||||
#if PY_VERSION_HEX >= 0x03040000
|
||||
FILE *fs = fopen(f, "r");
|
||||
#elif PY_VERSION_HEX >= 0x03000000
|
||||
PyObject *fo = Py_BuildValue("s", f);
|
||||
FILE *fs = _Py_fopen(fo, "r");
|
||||
Py_DECREF(fo);
|
||||
#else
|
||||
// Let python open the file to avoid potential binary incompatibilities.
|
||||
PyObject *pyfile = PyFile_FromString(f, const_cast<char*>("r"));
|
||||
|
||||
Reference in New Issue
Block a user