Skip to content

Commit fd39e2a

Browse files
authored
bpo-31474: Fix -Wint-in-bool-context warnings (#3581)
Signed-off-by: Christian Heimes <christian@python.org>
1 parent c7f165f commit fd39e2a

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

‎Include/pymem.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,9 @@ PyAPI_FUNC(void) PyMem_Free(void *);
7272
/* Returns NULL to indicate error if a negative size or size larger than
7373
Py_ssize_t can represent is supplied. Helps prevents security holes. */
7474
#define PyMem_MALLOC(n) ((size_t)(n) > (size_t)PY_SSIZE_T_MAX ? NULL \
75-
: malloc((n) ? (n) : 1))
75+
: malloc(((n) != 0) ? (n) : 1))
7676
#define PyMem_REALLOC(p, n) ((size_t)(n) > (size_t)PY_SSIZE_T_MAX ? NULL \
77-
: realloc((p), (n) ? (n) : 1))
77+
: realloc((p), ((n) != 0) ? (n) : 1))
7878
#define PyMem_FREE free
7979

8080
#endif /* PYMALLOC_DEBUG */
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix -Wint-in-bool-context warnings in PyMem_MALLOC and PyMem_REALLOC macros

0 commit comments

Comments
 (0)