Skip to content

Commit 786c514

Browse files
committed
Fix the compiler warning
1 parent 991f307 commit 786c514

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Include/pymacro.h

+3-1
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,8 @@
151151
#define _Py_RVALUE(EXPR) ((void)0, (EXPR))
152152

153153
// Return non-zero if the type is signed, return zero if it's unsigned.
154-
#define _Py_IS_TYPE_SIGNED(type) ((type)(-1) < 0)
154+
// Use "<= 0" rather than "< 0" to prevent the compiler warning:
155+
// "comparison of unsigned expression in '< 0' is always false".
156+
#define _Py_IS_TYPE_SIGNED(type) ((type)(-1) <= 0)
155157

156158
#endif /* Py_PYMACRO_H */

0 commit comments

Comments
 (0)