Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

REV: revert change to numpyconfig.h for sizeof(type) hardcoding on macOS #22805

Merged
merged 1 commit into from Dec 15, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
52 changes: 52 additions & 0 deletions numpy/core/include/numpy/numpyconfig.h
Expand Up @@ -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
Expand Down