On Wed, May 6, 2015 at 2:03 PM, Andrey Semashev
On Thu, Apr 9, 2015 at 4:00 PM, Stefan Seefeld
wrote: On 09/04/15 02:58 AM, Mark Incley wrote:
It's Python 3.3.0. In the file c:\Python33\include\fileutils.h there's only the following two fopen functions:
[...]
*Sigh*. It apears the new API was introduced here: https://hg.python.org/cpython/rev/ef889c3d5dc6 That's the price to pay for using non-public APIs...
I have just committed https://github.com/boostorg/python/commit/3e405b6fd5db5615bbef241763de070118..., which should preserve the new functionality for Python 3.4, and use a little workaround for Python 3 < 3.4
This fix doesn't work on Ubuntu 15.04 (python 3.4.3).
libs/python/src/exec.cpp: In function ‘boost::python::api::object boost::python::exec_file(boost::python::str, boost::python::api::object, boost::python::api::object)’: libs/python/src/exec.cpp:93:31: error: cannot convert ‘PyObject* {aka _object*}’ to ‘const char*’ for argument ‘1’ to ‘FILE* _Py_fopen(const char*, const char*)’ FILE *fs = _Py_fopen(fo, "r");
If I'm not mistaken, the version check is incorrect, it should be:
#if PY_VERSION_HEX >= 0x03040000
(note that 4 is shifted left for 16 bits, not 20).
With the above fix it compiled for me. Created a pull request: https://github.com/boostorg/python/pull/19 It would be nice if the patch in the 1.58 release notes was also updated.