[C++-sig] Boost.Python with Python 2.5 64-bit compile error (Linux, AMD, x86_64)

Pierre Bourgault pierre.bourgault at autodesk.com
Mon Apr 16 21:33:37 CEST 2007


Hi,

I was compiling Boost.Python against Python 2.5 in 64-bit (AMD, Linux) and was getting the following error:

/var/tmp/boost_1_33_1/libs/python/build/../src/object_protocol.cpp: In function `PyObject* boost::python::api::<unnamed>::apply_slice(PyObject*, PyObject*, PyObject*)':
/var/tmp/boost_1_33_1/libs/python/build/../src/object_protocol.cpp:110: error: cannot convert `int*' to `Py_ssize_t*' for argument `2' to `int _PyEval_SliceIndex(PyObject*, Py_ssize_t*)'

Looking into object_protocol.cpp, a comment says that apply_slice() and assign_slice() were copy/pasted from Python source. Comparing Python 2.5 apply_slice with boost apply_slice shows the following difference:
Boost:
  int ilow = 0, ihigh = INT_MAX;
  if (!_PyEval_SliceIndex(v, &ilow))
     return -1;

Python 2.5:
  Py_ssize_t ilow = 0, ihigh = PY_SSIZE_T_MAX;
  if (!_PyEval_SliceIndex(v, &ilow))
     return -1;

I fixed the boost file and it worked. I suppose there are good reasons for 
the copy/paste but it was not for that, the error would have never shown.

Pierre Bourgault

---

FYI, I use bjam (3.1.13) but I had to edit jam.h so that OSPLAT is also defined for x86_64.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20070416/9c81853d/attachment.htm>


More information about the Cplusplus-sig mailing list