Skip to content

Commit 9dde142

Browse files
authored
Merge pull request #496 from jcarpent/topic/devel
Fix compatibility issue on Windows for NumPy 2.x
2 parents 3586fcb + 61c1d93 commit 9dde142

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

.github/workflows/conda/environment_all.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ channels:
44
dependencies:
55
- eigen
66
- cmake
7-
- numpy<2.0
7+
- numpy
88
- pkg-config
99
- boost
1010
- ccache

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
1414
- Add more general visitor `GenericMapPythonVisitor` for map types test `boost::unordered_map<std::string, int>` ([#504](https://github.com/stack-of-tasks/eigenpy/pull/504))
1515
- Support for non-[default-contructible](https://en.cppreference.com/w/cpp/named_req/DefaultConstructible) types in map types ([#504](https://github.com/stack-of-tasks/eigenpy/pull/504))
1616
- Add type_info helpers ([#502](https://github.com/stack-of-tasks/eigenpy/pull/502))
17+
- Add NumPy 2 support ([#496](https://github.com/stack-of-tasks/eigenpy/pull/496))
1718

1819
### Changed
1920

include/eigenpy/numpy.hpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,17 @@
55
#ifndef __eigenpy_numpy_hpp__
66
#define __eigenpy_numpy_hpp__
77

8-
#include "eigenpy/fwd.hpp"
8+
#include "eigenpy/config.hpp"
99

1010
#ifndef PY_ARRAY_UNIQUE_SYMBOL
1111
#define PY_ARRAY_UNIQUE_SYMBOL EIGENPY_ARRAY_API
1212
#endif
1313

14+
// For compatibility with Numpy 2.x
15+
// See
16+
// https://numpy.org/devdocs/reference/c-api/array.html#c.NPY_API_SYMBOL_ATTRIBUTE
17+
#define NPY_API_SYMBOL_ATTRIBUTE EIGENPY_DLLAPI
18+
1419
#include <numpy/numpyconfig.h>
1520
#ifdef NPY_1_8_API_VERSION
1621
#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
@@ -50,6 +55,8 @@ static inline void _Py_SET_TYPE(PyObject* o, PyTypeObject* type) {
5055
#define EIGENPY_GET_PY_ARRAY_TYPE(array) PyArray_MinScalarType(array)->type_num
5156
#endif
5257

58+
#include <complex>
59+
5360
namespace eigenpy {
5461
void EIGENPY_DLLAPI import_numpy();
5562
int EIGENPY_DLLAPI PyArray_TypeNum(PyTypeObject* type);

0 commit comments

Comments
 (0)