Skip to content

Commit beb83d0

Browse files
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 (cherry picked from commit 9445118) Co-authored-by: Max Bélanger <[email protected]>
1 parent 7cba835 commit beb83d0

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Properly guard the use of the ``CLOCK_GETTIME`` et al. macros in ``timemodule``
2+
on macOS.

Modules/timemodule.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1350,6 +1350,8 @@ PyInit_time(void)
13501350
/* Set, or reset, module variables like time.timezone */
13511351
PyInit_timezone(m);
13521352

1353+
#if defined(HAVE_CLOCK_GETTIME) || defined(HAVE_CLOCK_SETTIME) || defined(HAVE_CLOCK_GETRES)
1354+
13531355
#ifdef CLOCK_REALTIME
13541356
PyModule_AddIntMacro(m, CLOCK_REALTIME);
13551357
#endif
@@ -1369,6 +1371,8 @@ PyInit_time(void)
13691371
PyModule_AddIntMacro(m, CLOCK_THREAD_CPUTIME_ID);
13701372
#endif
13711373

1374+
#endif /* defined(HAVE_CLOCK_GETTIME) || defined(HAVE_CLOCK_SETTIME) || defined(HAVE_CLOCK_GETRES) */
1375+
13721376
if (!initialized) {
13731377
if (PyStructSequence_InitType2(&StructTimeType,
13741378
&struct_time_type_desc) < 0)

0 commit comments

Comments
 (0)