diff options
| author | Rohit Goswami <rgoswami@quansight.com> | 2022-03-21 03:32:14 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-03-21 03:32:14 +0000 |
| commit | 1d9ade8895f8f385e1d44f41a752dbb9ba3438b2 (patch) | |
| tree | 728ee629b572cc71e1acfd833b46110689bedfdc /numpy | |
| parent | a8f9711493adee93fa3d61e7ef1bee11d7055a85 (diff) | |
| parent | 5ffe257a19c5125ad981a5de018e5d492797d2e4 (diff) | |
| download | numpy-1d9ade8895f8f385e1d44f41a752dbb9ba3438b2.tar.gz | |
Merge pull request #20884 from HaoZeke/f2py_npyOS
MAINT: Minor cleanup to F2PY
Diffstat (limited to 'numpy')
| -rw-r--r-- | numpy/core/include/numpy/npy_os.h | 4 | ||||
| -rw-r--r-- | numpy/f2py/cfuncs.py | 10 | ||||
| -rwxr-xr-x | numpy/f2py/rules.py | 4 |
3 files changed, 12 insertions, 6 deletions
diff --git a/numpy/core/include/numpy/npy_os.h b/numpy/core/include/numpy/npy_os.h index efa0e4012..6d335f751 100644 --- a/numpy/core/include/numpy/npy_os.h +++ b/numpy/core/include/numpy/npy_os.h @@ -21,6 +21,10 @@ #define NPY_OS_CYGWIN #elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32) #define NPY_OS_WIN32 +#elif defined(_WIN64) || defined(__WIN64__) || defined(WIN64) + #define NPY_OS_WIN64 +#elif defined(__MINGW32__) || defined(__MINGW64__) + #define NPY_OS_MINGW #elif defined(__APPLE__) #define NPY_OS_DARWIN #else diff --git a/numpy/f2py/cfuncs.py b/numpy/f2py/cfuncs.py index bdd27adaf..f69933543 100644 --- a/numpy/f2py/cfuncs.py +++ b/numpy/f2py/cfuncs.py @@ -51,8 +51,6 @@ includes0['math.h'] = '#include <math.h>' includes0['string.h'] = '#include <string.h>' includes0['setjmp.h'] = '#include <setjmp.h>' -includes['Python.h'] = '#include <Python.h>' -needs['arrayobject.h'] = ['Python.h'] includes['arrayobject.h'] = '''#define PY_ARRAY_UNIQUE_SYMBOL PyArray_API #include "arrayobject.h"''' @@ -66,7 +64,7 @@ typedefs['unsigned_short'] = 'typedef unsigned short unsigned_short;' typedefs['unsigned_long'] = 'typedef unsigned long unsigned_long;' typedefs['signed_char'] = 'typedef signed char signed_char;' typedefs['long_long'] = """\ -#ifdef _WIN32 +#if defined(NPY_OS_WIN32) typedef __int64 long_long; #else typedef long long long_long; @@ -74,7 +72,7 @@ typedef unsigned long long unsigned_long_long; #endif """ typedefs['unsigned_long_long'] = """\ -#ifdef _WIN32 +#if defined(NPY_OS_WIN32) typedef __uint64 long_long; #else typedef unsigned long long unsigned_long_long; @@ -574,13 +572,13 @@ cppmacros["F2PY_THREAD_LOCAL_DECL"] = """\ #ifndef F2PY_THREAD_LOCAL_DECL #if defined(_MSC_VER) #define F2PY_THREAD_LOCAL_DECL __declspec(thread) -#elif defined(__MINGW32__) || defined(__MINGW64__) +#elif defined(NPY_OS_MINGW) #define F2PY_THREAD_LOCAL_DECL __thread #elif defined(__STDC_VERSION__) \\ && (__STDC_VERSION__ >= 201112L) \\ && !defined(__STDC_NO_THREADS__) \\ && (!defined(__GLIBC__) || __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 12)) \\ - && !defined(__OpenBSD__) + && !defined(NPY_OS_OPENBSD) /* __STDC_NO_THREADS__ was first defined in a maintenance release of glibc 2.12, see https://lists.gnu.org/archive/html/commit-hurd/2012-07/msg00180.html, so `!defined(__STDC_NO_THREADS__)` may give false positive for the existence diff --git a/numpy/f2py/rules.py b/numpy/f2py/rules.py index 78810a0a7..eaa559528 100755 --- a/numpy/f2py/rules.py +++ b/numpy/f2py/rules.py @@ -124,6 +124,10 @@ extern \"C\" { #define PY_SSIZE_T_CLEAN #endif /* PY_SSIZE_T_CLEAN */ +/* Unconditionally included */ +#include <Python.h> +#include <numpy/npy_os.h> + """ + gentitle("See f2py2e/cfuncs.py: includes") + """ #includes# #includes0# |
