diff --git a/numpy/core/include/numpy/npy_os.h b/numpy/core/include/numpy/npy_os.h index efa0e4012f91..6d335f75159b 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 bdd27adaf4c6..f69933543918 100644 --- a/numpy/f2py/cfuncs.py +++ b/numpy/f2py/cfuncs.py @@ -51,8 +51,6 @@ includes0['string.h'] = '#include ' includes0['setjmp.h'] = '#include ' -includes['Python.h'] = '#include ' -needs['arrayobject.h'] = ['Python.h'] includes['arrayobject.h'] = '''#define PY_ARRAY_UNIQUE_SYMBOL PyArray_API #include "arrayobject.h"''' @@ -66,7 +64,7 @@ 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 @@ #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 @@ #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 78810a0a74a9..eaa559528513 100755 --- a/numpy/f2py/rules.py +++ b/numpy/f2py/rules.py @@ -124,6 +124,10 @@ #define PY_SSIZE_T_CLEAN #endif /* PY_SSIZE_T_CLEAN */ +/* Unconditionally included */ +#include +#include + """ + gentitle("See f2py2e/cfuncs.py: includes") + """ #includes# #includes0#