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
This commit is contained in:
Max Bélanger 2018-10-20 17:07:54 -07:00 committed by Benjamin Peterson
parent 12d0ff1230
commit 94451182cc
2 changed files with 6 additions and 0 deletions

View File

@ -0,0 +1,2 @@
Properly guard the use of the ``CLOCK_GETTIME`` et al. macros in ``timemodule``
on macOS.

View File

@ -1723,6 +1723,8 @@ PyInit_time(void)
/* Set, or reset, module variables like time.timezone */
PyInit_timezone(m);
#if defined(HAVE_CLOCK_GETTIME) || defined(HAVE_CLOCK_SETTIME) || defined(HAVE_CLOCK_GETRES)
#ifdef CLOCK_REALTIME
PyModule_AddIntMacro(m, CLOCK_REALTIME);
#endif
@ -1751,6 +1753,8 @@ PyInit_time(void)
PyModule_AddIntMacro(m, CLOCK_UPTIME);
#endif
#endif /* defined(HAVE_CLOCK_GETTIME) || defined(HAVE_CLOCK_SETTIME) || defined(HAVE_CLOCK_GETRES) */
if (!initialized) {
if (PyStructSequence_InitType2(&StructTimeType,
&struct_time_type_desc) < 0)