10000 ENH: Add some needed macros to include files. · numpy/numpy@f6a2c7c · GitHub
[go: up one dir, main page]

Skip to content

Commit f6a2c7c

Browse files
committed
ENH: Add some needed macros to include files.
The unprefixed macros in interrupt.h were prefixed with NPY_, The unprefixed macros in interrupt.h were added to noprefix.h. The arrayobject.h file was fixed to work with the new interrupt.h. Some needed macros were added to npy_common.h.
1 parent 9897d95 commit f6a2c7c

File tree

4 files changed

+18
-12
lines changed

4 files changed

+18
-12
lines changed

numpy/core/include/numpy/arrayobject.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,12 @@
1111

1212
#ifndef Py_ARRAYOBJECT_H
1313
#define Py_ARRAYOBJECT_H
14+
1415
#include "ndarrayobject.h"
16+
#include "npy_interrupt.h"
17+
1518
#ifdef NPY_NO_PREFIX
1619
#include "noprefix.h"
1720
#endif
1821

19-
#include "npy_interrupt.h"
20-
2122
#endif

numpy/core/include/numpy/noprefix.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,13 @@
77
*/
88
#ifndef NPY_NO_PREFIX
99
#include "ndarrayobject.h"
10+
#include "npy_interrupt.h"
1011
#endif
1112

13+
#define SIGSETJMP NPY_SIGSETJMP
14+
#define SIGLONGJMP NPY_SIGLONGJMP
15+
#define SIGJMP_BUF NPY_SIGJMP_BUF
16+
1217
#define MAX_DIMS NPY_MAXDIMS
1318

1419
#define longlong npy_longlon 10000 g

numpy/core/include/numpy/npy_common.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ typedef Py_uintptr_t npy_uintp;
8282
#define PyIntpArrType_Type PyLongArrType_Type
8383
#define PyUIntpArrType_Type PyULongArrType_Type
8484
#define NPY_MAX_INTP NPY_MAX_LONG
85-
#define NPY_MIN_INTP MIN_LONG
85+
#define NPY_MIN_INTP NPY_MIN_LONG
8686
#define NPY_MAX_UINTP NPY_MAX_ULONG
8787
#define NPY_INTP_FMT "ld"
8888
#elif defined(PY_LONG_LONG) && (NPY_SIZEOF_PY_INTPTR_T == NPY_SIZEOF_LONGLONG)

numpy/core/include/numpy/npy_interrupt.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -85,22 +85,22 @@ Interrupt handling does not work well with threads.
8585

8686
#ifndef sigsetjmp
8787

88-
#define SIGSETJMP(arg1, arg2) setjmp(arg1)
89-
#define SIGLONGJMP(arg1, arg2) longjmp(arg1, arg2)
90-
#define SIGJMP_BUF jmp_buf
88+
#define NPY_SIGSETJMP(arg1, arg2) setjmp(arg1)
89+
#define NPY_SIGLONGJMP(arg1, arg2) longjmp(arg1, arg2)
90+
#define NPY_SIGJMP_BUF jmp_buf
9191

9292
#else
9393

94-
#define SIGSETJMP(arg1, arg2) sigsetjmp(arg1, arg2)
95-
#define SIGLONGJMP(arg1, arg2) siglongjmp(arg1, arg2)
96-
#define SIGJMP_BUF sigjmp_buf
94+
#define NPY_SIGSETJMP(arg1, arg2) sigsetjmp(arg1, arg2)
95+
#define NPY_SIGLONGJMP(arg1, arg2) siglongjmp(arg1, arg2)
96+
#define NPY_SIGJMP_BUF sigjmp_buf
9797

9898
#endif
9999

100100
# define NPY_SIGINT_ON { \
101101
PyOS_sighandler_t _npy_sig_save; \
102102
_npy_sig_save = PyOS_setsig(SIGINT, _PyArray_SigintHandler); \
103-
if (SIGSETJMP(*((SIGJMP_BUF *)_PyArray_GetSigintBuf()), \
103+
if (NPY_SIGSETJMP(*((NPY_SIGJMP_BUF *)_PyArray_GetSigintBuf()), \
104104
1) == 0) { \
105105

106106
# define NPY_SIGINT_OFF } \
@@ -109,8 +109,8 @@ Interrupt handling does not work well with threads.
109109

110110
#else /* NPY_NO_SIGNAL */
111111

112-
# define NPY_SIGINT_ON
113-
# define NPY_SIGINT_OFF
112+
#define NPY_SIGINT_ON
113+
#define NPY_SIGINT_OFF
114114

115115
#endif /* HAVE_SIGSETJMP */
116116

0 commit comments

Comments
 (0)
0