boostorg / python

Boost.org python module
http://boostorg.github.io/python
Boost Software License 1.0
465 stars 201 forks source link

Compilation failure using numpy 2.0.0b1 #431

Closed duburcqa closed 3 months ago

duburcqa commented 5 months ago

I tried to compile Boost::Python 1.84 library against numpy==2.0.0b1, but I'm getting a compilation error:

libs/python/src/numpy/dtype.cpp:101:83: error: no member named 'elsize' in '_PyArray_Descr'
int dtype::get_itemsize() const { return reinterpret_cast<PyArray_Descr*>(ptr())->elsize;}
duburcqa commented 5 months ago

See related part of numpy documentation: https://numpy.org/devdocs/release/2.0.0-notes.html#descriptor-elsize-and-alignment-access

The new accessor PyDataType_ELSIZE must be used: PyDataType_ELSIZE(reinterpret_cast<PyArray_Descr*>(ptr()))

jakirkham commented 3 months ago

Was this fixed with PR ( https://github.com/boostorg/python/pull/432 )?

duburcqa commented 3 months ago

Yes. Closing.

jakirkham commented 3 months ago

Thanks Alexis! 🙏

jakobandersen commented 6 days ago

While fixed now, it doesn't seem possible to build any prior Boost release if NumPy 2.x is installed. Is it possible to disable just the NumPy part when building via the central b2?

jakirkham commented 6 days ago

Boost 1.86.0 got released just a few days ago. Did this not make it in there?

jakobandersen commented 6 days ago

Boost 1.86.0 got released just a few days ago. Did this not make it in there?

It doesn't look like it :-(

jakirkham commented 6 days ago

@stefanseefeld what do we need to do to get this in the next Boost release? Is 1.86.1 an option?