Fix some warnings produced by different compilers. (GH-5593) (GH-5600)
(cherry picked from commit bfe4fd5f2e96e72eecb5b8a0c7df0ac1689f3b7e)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
diff --git a/Modules/timemodule.c b/Modules/timemodule.c
index b17ab5a..998216c 100644
--- a/Modules/timemodule.c
+++ b/Modules/timemodule.c
@@ -1192,11 +1192,13 @@
if (freq != -1) {
/* check that _PyTime_MulDiv(t, SEC_TO_NS, ticks_per_second)
cannot overflow below */
+#if LONG_MAX > _PyTime_MAX / SEC_TO_NS
if ((_PyTime_t)freq > _PyTime_MAX / SEC_TO_NS) {
PyErr_SetString(PyExc_OverflowError,
"_SC_CLK_TCK is too large");
return -1;
}
+#endif
ticks_per_second = freq;
}