Skip to content

Commit

Permalink
Revert "Merge pull request numpy#22972 from charris/backport-22939"
Browse files Browse the repository at this point in the history
This reverts commit 30535f4, reversing
changes made to 9b01523.
  • Loading branch information
charris committed Feb 4, 2023
1 parent 77fc6cf commit 0309fd7
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 16 deletions.
14 changes: 10 additions & 4 deletions numpy/core/include/numpy/npy_math.h
Expand Up @@ -184,23 +184,29 @@ NPY_INPLACE double npy_atan2(double x, double y);
#define npy_fmod fmod
#define npy_floor floor
#define npy_expm1 expm1
#define npy_log1p log1p
#define npy_acosh acosh
#define npy_asinh asinh
#define npy_atanh atanh
#define npy_rint rint
#define npy_trunc trunc
#define npy_exp2 exp2
#define npy_frexp frexp
#define npy_ldexp ldexp
#define npy_copysign copysign
#define npy_exp exp
#define npy_sqrt sqrt
#define npy_pow pow
#define npy_modf modf

#if defined(__arm64__) && defined(__APPLE__)
/* due to a build problem with scipy, export these as functions */
NPY_INPLACE double npy_asinh(double x);
NPY_INPLACE double npy_copysign(double y, double x);
NPY_INPLACE double npy_log1p(double x);
#else
#define npy_asinh asinh
#define npy_copysign copysign
#define npy_log1p log1p
#endif
double npy_nextafter(double x, double y);

double npy_spacing(double x);

/*
Expand Down
8 changes: 4 additions & 4 deletions numpy/core/setup.py
Expand Up @@ -771,6 +771,10 @@ def get_mathlib_info(*args):
join('src', 'npymath', 'ieee754.c.src'),
join('src', 'npymath', 'npy_math_complex.c.src'),
join('src', 'npymath', 'halffloat.c'),
# Remove this once scipy macos arm64 build correctly
# links to the arm64 npymath library,
# see gh-22673
join('src', 'npymath', 'arm64_exports.c'),
]

config.add_installed_library('npymath',
Expand Down Expand Up @@ -1002,10 +1006,6 @@ def get_mathlib_info(*args):
join('src', 'multiarray', 'textreading', 'stream_pyobject.c'),
join('src', 'multiarray', 'textreading', 'str_to_int.c'),
join('src', 'multiarray', 'textreading', 'tokenize.cpp'),
# Remove this once scipy macos arm64 build correctly
# links to the arm64 npymath library,
# see gh-22673
join('src', 'npymath', 'arm64_exports.c'),
]

#######################################################################
Expand Down
9 changes: 1 addition & 8 deletions numpy/core/src/npymath/arm64_exports.c
@@ -1,14 +1,12 @@
#if defined(__arm64__) && defined(__APPLE__)

#include <math.h>
/*
/*
* Export these for scipy, since the SciPy build for macos arm64
* downloads the macos x86_64 NumPy, and does not error when the
* linker fails to use npymathlib.a. Importing numpy will expose
* these external functions
* See https://github.com/numpy/numpy/issues/22673#issuecomment-1327520055
*
* This file is actually compiled as part of the main module.
*/

double npy_asinh(double x) {
Expand All @@ -22,9 +20,4 @@ double npy_copysign(double y, double x) {
double npy_log1p(double x) {
return log1p(x);
}

double npy_nextafter(double x, double y) {
return nextafter(x, y);
}

#endif

0 comments on commit 0309fd7

Please sign in to comment.