Skip to content

Commit 8788b13

Browse files
committed
py: Check for NDEBUG using #ifdef rather than #if.
Defining NDEBUG (to any value, even 0) disables debugging. Otherwise, if it's not defined, debugging is enabled.
1 parent 17d299b commit 8788b13

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

py/obj.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ const char *mp_obj_get_type_str(mp_const_obj_t o_in) {
5656
void mp_obj_print_helper(void (*print)(void *env, const char *fmt, ...), void *env, mp_obj_t o_in, mp_print_kind_t kind) {
5757
// There can be data structures nested too deep, or just recursive
5858
MP_STACK_CHECK();
59-
#if !NDEBUG
59+
#ifndef NDEBUG
6060
if (o_in == NULL) {
6161
print(env, "(nil)");
6262
return;

py/obj.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ typedef struct _mp_obj_base_t mp_obj_base_t;
6161
// For debugging purposes they are all different. For non-debug mode, we alias
6262
// as many as we can to MP_OBJ_NULL because it's cheaper to load/compare 0.
6363

64-
#if NDEBUG
64+
#ifdef NDEBUG
6565
#define MP_OBJ_NULL ((mp_obj_t)0)
6666
#define MP_OBJ_STOP_ITERATION ((mp_obj_t)0)
6767
#define MP_OBJ_SENTINEL ((mp_obj_t)4)

0 commit comments

Comments
 (0)