Skip to content

Commit 002aef3

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 f141dda commit 002aef3

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
@@ -1700,6 +1700,8 @@ PyInit_time(void)
17001700
/* Set, or reset, module variables like time.timezone */
17011701
PyInit_timezone(m);
17021702

1703+
#if defined(HAVE_CLOCK_GETTIME) || defined(HAVE_CLOCK_SETTIME) || defined(HAVE_CLOCK_GETRES)
1704+
17031705
#ifdef CLOCK_REALTIME
17041706
PyModule_AddIntMacro(m, CLOCK_REALTIME);
17051707
#endif
@@ -1728,6 +1730,8 @@ PyInit_time(void)
17281730
PyModule_AddIntMacro(m, CLOCK_UPTIME);
17291731
#endif
17301732

1733+
#endif /* defined(HAVE_CLOCK_GETTIME) || defined(HAVE_CLOCK_SETTIME) || defined(HAVE_CLOCK_GETRES) */
1734+
17311735
if (!initialized) {
17321736
if (PyStructSequence_InitType2(&StructTimeType,
17331737
&struct_time_type_desc) < 0)

0 commit comments

Comments
 (0)