Skip to content

Commit 03d5730

Browse files
authored
MAINT: Fix some undef warnings (#29216)
As noted by Chuck in gh-29138, there are some undef warnings that seem not nice this should fix them. The fact that `NPY_LONG`, etc. are not defined at macro expansion time is a bit of a trap, maybe it would be nice to have CI fail for this...
1 parent 2f4ace7 commit 03d5730

File tree

9 files changed

+12
-12
lines changed

9 files changed

+12
-12
lines changed

numpy/_core/src/_simd/_simd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ PyMODINIT_FUNC PyInit__simd(void)
8888
NPY_MTARGETS_CONF_DISPATCH(NPY_CPU_HAVE, ATTACH_MODULE, MAKE_MSVC_HAPPY)
8989
NPY_MTARGETS_CONF_BASELINE(ATTACH_BASELINE_MODULE, MAKE_MSVC_HAPPY)
9090

91-
#if Py_GIL_DISABLED
91+
#ifdef Py_GIL_DISABLED
9292
// signal this module supports running with the GIL disabled
9393
PyUnstable_Module_SetGIL(m, Py_MOD_GIL_NOT_USED);
9494
#endif

numpy/_core/src/multiarray/descriptor.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2095,7 +2095,7 @@ static PyMemberDef arraydescr_members[] = {
20952095
{"alignment",
20962096
T_PYSSIZET, offsetof(PyArray_Descr, alignment), READONLY, NULL},
20972097
{"flags",
2098-
#if NPY_ULONGLONG == NPY_UINT64
2098+
#if NPY_SIZEOF_LONGLONG == 8
20992099
T_ULONGLONG, offsetof(PyArray_Descr, flags), READONLY, NULL},
21002100
#else
21012101
#error Assuming long long is 64bit, if not replace with getter function.

numpy/_core/src/umath/_operand_flag_tests.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ PyMODINIT_FUNC PyInit__operand_flag_tests(void)
7777
((PyUFuncObject*)ufunc)->iter_flags = NPY_ITER_REDUCE_OK;
7878
PyModule_AddObject(m, "inplace_add", (PyObject*)ufunc);
7979

80-
#if Py_GIL_DISABLED
80+
#ifdef Py_GIL_DISABLED
8181
// signal this module supports running with the GIL disabled
8282
PyUnstable_Module_SetGIL(m, Py_MOD_GIL_NOT_USED);
8383
#endif

numpy/_core/src/umath/_rational_tests.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1355,7 +1355,7 @@ PyMODINIT_FUNC PyInit__rational_tests(void) {
13551355
GCD_LCM_UFUNC(gcd,NPY_INT64,"greatest common denominator of two integers");
13561356
GCD_LCM_UFUNC(lcm,NPY_INT64,"least common multiple of two integers");
13571357

1358-
#if Py_GIL_DISABLED
1358+
#ifdef Py_GIL_DISABLED
13591359
// signal this module supports running with the GIL disabled
13601360
PyUnstable_Module_SetGIL(m, Py_MOD_GIL_NOT_USED);
13611361
#endif

numpy/_core/src/umath/_struct_ufunc_tests.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ PyMODINIT_FUNC PyInit__struct_ufunc_tests(void)
157157
PyDict_SetItemString(d, "add_triplet", add_triplet);
158158
Py_DECREF(add_triplet);
159159

160-
#if Py_GIL_DISABLED
160+
#ifdef Py_GIL_DISABLED
161161
// signal this module supports running with the GIL disabled
162162
PyUnstable_Module_SetGIL(m, Py_MOD_GIL_NOT_USED);
163163
#endif

numpy/_core/src/umath/_umath_tests.c.src

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -944,7 +944,7 @@ PyMODINIT_FUNC PyInit__umath_tests(void) {
944944

945945
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
946946

947-
#if Py_GIL_DISABLED
947+
#ifdef Py_GIL_DISABLED
948948
// signal this module supports running with the GIL disabled
949949
PyUnstable_Module_SetGIL(m, Py_MOD_GIL_NOT_USED);
950950
#endif

numpy/_core/tests/examples/limited_api/limited_api_latest.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
#if Py_LIMITED_API != PY_VERSION_HEX & 0xffff0000
2-
# error "Py_LIMITED_API not defined to Python major+minor version"
3-
#endif
4-
51
#include <Python.h>
62
#include <numpy/arrayobject.h>
73
#include <numpy/ufuncobject.h>
84

5+
#if Py_LIMITED_API != PY_VERSION_HEX & 0xffff0000
6+
# error "Py_LIMITED_API not defined to Python major+minor version"
7+
#endif
8+
99
static PyModuleDef moduledef = {
1010
.m_base = PyModuleDef_HEAD_INIT,
1111
.m_name = "limited_api_latest"

numpy/f2py/rules.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@
286286
#initcommonhooks#
287287
#interface_usercode#
288288
289-
#if Py_GIL_DISABLED
289+
#ifdef Py_GIL_DISABLED
290290
// signal whether this module supports running with the GIL disabled
291291
PyUnstable_Module_SetGIL(m , #gil_used#);
292292
#endif

numpy/f2py/tests/src/array_from_pyobj/wrapmodule.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ PyMODINIT_FUNC PyInit_test_array_from_pyobj_ext(void) {
223223
on_exit(f2py_report_on_exit,(void*)"array_from_pyobj.wrap.call");
224224
#endif
225225

226-
#if Py_GIL_DISABLED
226+
#ifdef Py_GIL_DISABLED
227227
// signal whether this module supports running with the GIL disabled
228228
PyUnstable_Module_SetGIL(m, Py_MOD_GIL_NOT_USED);
229229
#endif

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy