
I was exploring the boost C++ library support for Python 3 extensions with Python3.5 using a built-from-source copy of pypy using the py3.5 branch. Below are the errors I encountered.
Are these expected problems that someone is working on? Should someone be working on them? Or is this intended behavior and I should adapt boost?
Thanks --david
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:89:30: error: ‘_Py_fopen’ was not declared in this scope FILE *fs = _Py_fopen(f, "r"); ^
libs/python/src/wrapper.cpp: In member function ‘boost::python::override boost::python::detail::wrapper_base::get\_override(const char*, PyTypeObject*) const’: libs/python/src/wrapper.cpp:28:50: error: ‘struct PyMethodObject’ has no member named ‘im_self’
&& ((PyMethodObject*)m.get())->im_self == this->m_self
^ libs/python/src/wrapper.cpp:37:61: error: ‘struct PyMethodObject’ has no member named ‘im_func’ if (borrowed_f != ((PyMethodObject*)m.get())->im_func) ^

David,
since I didn't see a reply, I'm having a stab at it ...
There is patch file for wrapper.cpp:
pypy/module/cpyext/patches/boost.patch
which looks to be what you want, as it modifies the 'offending' code. I've not tested it.
And out of curiosity, why boost? cpyext needs to do a mapping of internal representations, which can be costly, and boost.python isn't known for speed either?
Best regards, Wim

Thanks. Did you look into the missing Py_fopen as well?
To answer your question, Facebook has a large python application which leverages an even larger C++ code base which is exposed to python with iva sadly large number of different ways including Boost. We are interested in using PyPy but need to work through a bunch of these issues to even evaluate. --david
On 8/4/17, 11:30 AM, "wlavrijsen@lbl.gov" wlavrijsen@lbl.gov wrote:
David,
since I didn't see a reply, I'm having a stab at it ...
There is patch file for wrapper.cpp:
pypy/module/cpyext/patches/boost.patch
which looks to be what you want, as it modifies the 'offending' code. I've not tested it.
And out of curiosity, why boost? cpyext needs to do a mapping of internal representations, which can be costly, and boost.python isn't known for speed either?
Best regards, Wim -- WLavrijsen@lbl.gov -- +1 (510) 486 6411 -- www.lavrijsen.net

Wow, this is a 7-year old issue with boost; https://svn.boost.org/trac10/ticket/4125 (
On 8/4/17, 12:55 PM, "David Callahan" dcallahan@fb.com wrote:
Thanks. Did you look into the missing Py_fopen as well?
To answer your question, Facebook has a large python application which leverages an even larger C++ code base which is exposed to python with iva sadly large number of different ways including Boost. We are interested in using PyPy but need to work through a bunch of these issues to even evaluate. --david
On 8/4/17, 11:30 AM, "wlavrijsen@lbl.gov" wlavrijsen@lbl.gov wrote:
David,
since I didn't see a reply, I'm having a stab at it ...
There is patch file for wrapper.cpp:
pypy/module/cpyext/patches/boost.patch
which looks to be what you want, as it modifies the 'offending' code. I've not tested it.
And out of curiosity, why boost? cpyext needs to do a mapping of internal representations, which can be costly, and boost.python isn't known for speed either?
Best regards, Wim -- WLavrijsen@lbl.gov -- +1 (510) 486 6411 -- www.lavrijsen.net

Never mind about Py_fopen, I see you gave me a workaround.
On 8/4/17, 1:18 PM, "David Callahan" dcallahan@fb.com wrote:
Wow, this is a 7-year old issue with boost; https://svn.boost.org/trac10/ticket/4125 (
On 8/4/17, 12:55 PM, "David Callahan" dcallahan@fb.com wrote:
Thanks. Did you look into the missing Py_fopen as well?
To answer your question, Facebook has a large python application which leverages an even larger C++ code base which is exposed to python with iva sadly large number of different ways including Boost. We are interested in using PyPy but need to work through a bunch of these issues to even evaluate. --david
On 8/4/17, 11:30 AM, "wlavrijsen@lbl.gov" wlavrijsen@lbl.gov wrote:
David,
since I didn't see a reply, I'm having a stab at it ...
There is patch file for wrapper.cpp:
pypy/module/cpyext/patches/boost.patch
which looks to be what you want, as it modifies the 'offending' code. I've not tested it.
And out of curiosity, why boost? cpyext needs to do a mapping of internal representations, which can be costly, and boost.python isn't known for speed either?
Best regards, Wim -- WLavrijsen@lbl.gov -- +1 (510) 486 6411 -- www.lavrijsen.net

David,
Wow, this is a 7-year old issue with boost; https://svn.boost.org/trac10/ticket/4125 (
well, I don't think boost.python has had any serious development effort behind it since 2004. (Although, the reference manual says (c) 2002-2005, so maybe there's been a bit.)
To answer your question, Facebook has a large python application which leverages an even larger C++ code base which is exposed to python with iva sadly large number of different ways including Boost.
Yes, no shortage of bindings options. In our field, we took inventory in 2003, and still ended up doing our own thing (is now: http://cppyy.readthedocs.io/). As it stood, it never gave anyone a reason to try anything else. That is now changing, with more external software being used. Lots of fun.
Best regards, Wim
participants (2)
-
David Callahan
-
wlavrijsen@lbl.gov