Commit 94451182 authored by Max Bélanger's avatar Max Bélanger Committed by Benjamin Peterson

closes bpo-35025: Properly guard the `CLOCK_GETTIME` et al macros in timemodule.c. (GH-9961)

Guard the `CLOCK_GETTIME` et al macros in `timemodule` based on the availability of the parent functions
parent 12d0ff12
Properly guard the use of the ``CLOCK_GETTIME`` et al. macros in ``timemodule``
on macOS.
...@@ -1723,6 +1723,8 @@ PyInit_time(void) ...@@ -1723,6 +1723,8 @@ PyInit_time(void)
/* Set, or reset, module variables like time.timezone */ /* Set, or reset, module variables like time.timezone */
PyInit_timezone(m); PyInit_timezone(m);
#if defined(HAVE_CLOCK_GETTIME) || defined(HAVE_CLOCK_SETTIME) || defined(HAVE_CLOCK_GETRES)
#ifdef CLOCK_REALTIME #ifdef CLOCK_REALTIME
PyModule_AddIntMacro(m, CLOCK_REALTIME); PyModule_AddIntMacro(m, CLOCK_REALTIME);
#endif #endif
...@@ -1751,6 +1753,8 @@ PyInit_time(void) ...@@ -1751,6 +1753,8 @@ PyInit_time(void)
PyModule_AddIntMacro(m, CLOCK_UPTIME); PyModule_AddIntMacro(m, CLOCK_UPTIME);
#endif #endif
#endif /* defined(HAVE_CLOCK_GETTIME) || defined(HAVE_CLOCK_SETTIME) || defined(HAVE_CLOCK_GETRES) */
if (!initialized) { if (!initialized) {
if (PyStructSequence_InitType2(&StructTimeType, if (PyStructSequence_InitType2(&StructTimeType,
&struct_time_type_desc) < 0) &struct_time_type_desc) < 0)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment