diff options
author | Sebastian Berg <sebastianb@nvidia.com> | 2022-12-15 14:08:44 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-15 14:08:44 +0100 |
commit | 458ee6443b8cb25407cc8d75b83254ee7eae4a9e (patch) | |
tree | dd324a26867a40c1b15e5e5d44eaeed477d0c60b | |
parent | 62e075c1c22530528bf5b6778ef51e212f65acb7 (diff) | |
parent | cbbda47c684953b90d323aec43907e39910e1698 (diff) | |
download | numpy-458ee6443b8cb25407cc8d75b83254ee7eae4a9e.tar.gz |
Merge pull request #22804 from rgommers/revert-header-change
REV: revert change to `numpyconfig.h` for sizeof(type) hardcoding on macOS
-rw-r--r-- | numpy/core/include/numpy/numpyconfig.h | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/numpy/core/include/numpy/numpyconfig.h b/numpy/core/include/numpy/numpyconfig.h index 308923b12..b7d7e2ca4 100644 --- a/numpy/core/include/numpy/numpyconfig.h +++ b/numpy/core/include/numpy/numpyconfig.h @@ -3,6 +3,58 @@ #include "_numpyconfig.h" +/* + * On Mac OS X, because there is only one configuration stage for all the archs + * in universal builds, any macro which depends on the arch needs to be + * hardcoded. + * + * Note that distutils/pip will attempt a universal2 build when Python itself + * is built as universal2, hence this hardcoding is needed even if we do not + * support universal2 wheels anymore (see gh-22796). + * This code block can be removed after we have dropped the setup.py based + * build completely. + */ +#ifdef __APPLE__ + #undef NPY_SIZEOF_LONG + #undef NPY_SIZEOF_PY_INTPTR_T + + #ifdef __LP64__ + #define NPY_SIZEOF_LONG 8 + #define NPY_SIZEOF_PY_INTPTR_T 8 + #else + #define NPY_SIZEOF_LONG 4 + #define NPY_SIZEOF_PY_INTPTR_T 4 + #endif + + #undef NPY_SIZEOF_LONGDOUBLE + #undef NPY_SIZEOF_COMPLEX_LONGDOUBLE + #ifdef HAVE_LDOUBLE_IEEE_DOUBLE_LE + #undef HAVE_LDOUBLE_IEEE_DOUBLE_LE + #endif + #ifdef HAVE_LDOUBLE_INTEL_EXTENDED_16_BYTES_LE + #undef HAVE_LDOUBLE_INTEL_EXTENDED_16_BYTES_LE + #endif + + #if defined(__arm64__) + #define NPY_SIZEOF_LONGDOUBLE 8 + #define NPY_SIZEOF_COMPLEX_LONGDOUBLE 16 + #define HAVE_LDOUBLE_IEEE_DOUBLE_LE 1 + #elif defined(__x86_64) + #define NPY_SIZEOF_LONGDOUBLE 16 + #define NPY_SIZEOF_COMPLEX_LONGDOUBLE 32 + #define HAVE_LDOUBLE_INTEL_EXTENDED_16_BYTES_LE 1 + #elif defined (__i386) + #define NPY_SIZEOF_LONGDOUBLE 12 + #define NPY_SIZEOF_COMPLEX_LONGDOUBLE 24 + #elif defined(__ppc__) || defined (__ppc64__) + #define NPY_SIZEOF_LONGDOUBLE 16 + #define NPY_SIZEOF_COMPLEX_LONGDOUBLE 32 + #else + #error "unknown architecture" + #endif +#endif + + /** * To help with the NPY_NO_DEPRECATED_API macro, we include API version * numbers for specific versions of NumPy. To exclude all API that was |