8000 Hide CAPI_WARN etc. behind NDEBUG · mattip/numpy@4678d48 · GitHub
[go: up one dir, main page]

Skip to content

Commit 4678d48

Browse files
committed
Hide CAPI_WARN etc. behind NDEBUG
1 parent 0b9272e commit 4678d48

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

numpy/core/include/numpy/ndarraytypes.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,12 @@ void _print_stack() {
4848
static NPY_INLINE HPyContext *
4949
npy_get_context(void)
5050
{
51+
#ifndef NDEBUG
5152
if (capi_warn_level() > 1) {
5253
printf("DEBUG WARNING: HPy context lookup (set CAPI_WARN_STACKTRACE=<limit> to show stack trace)\n");
5354
_print_stack();
5455
}
56+
#endif
5557
assert(numpy_global_ctx != NULL);
5658
return numpy_global_ctx;
5759
}
@@ -80,9 +82,14 @@ void perf_warn(const char *msg, const char *file, int lineno) {
8082
}
8183
}
8284

85+
#ifndef NDEBUG
8386
#define CAPI_WARN(_x) capi_warn0(_x, __FILE__, __LINE__)
84-
8587
#define HPY_PERFORMANCE_WARNING(_x) perf_warn(_x, __FILE__, __LINE__)
88+
#else
89+
#define CAPI_WARN(_x)
90+
#define HPY_PERFORMANCE_WARNING(_x)
91+
#endif
92+
8693

8794
static __attribute__ ((noreturn)) NPY_INLINE
8895
void hpy_abort_not_implemented(const char *where) {

0 commit comments

Comments
 (0)
0