]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-81057: Fix an ifdef in the time module (#100125)
authorEric Snow <ericsnowcurrently@gmail.com>
Fri, 9 Dec 2022 01:16:37 +0000 (18:16 -0700)
committerGitHub <noreply@github.com>
Fri, 9 Dec 2022 01:16:37 +0000 (18:16 -0700)
An earlier commit only defined check_ticks_per_second() when HAVE_TIMES is defined. However, we also need it when HAVE_CLOCK is defined. This primarily affects Windows.

https://github.com/python/cpython/issues/81057

Modules/timemodule.c

index ba4128c0fdf5b62adaa5f4479c6b03ba536bf27d..c2bacaae0c03395be29466c82963e772b11ddfc5 100644 (file)
@@ -62,8 +62,7 @@
 #define SEC_TO_NS (1000 * 1000 * 1000)
 
 
-#ifdef HAVE_TIMES
-
+#if defined(HAVE_TIMES) || defined(HAVE_CLOCK)
 static int
 check_ticks_per_second(long tps, const char *context)
 {
@@ -75,6 +74,9 @@ check_ticks_per_second(long tps, const char *context)
     }
     return 0;
 }
+#endif  /* HAVE_TIMES || HAVE_CLOCK */
+
+#ifdef HAVE_TIMES
 
 # define ticks_per_second _PyRuntime.time.ticks_per_second