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

Miss Islington (bot) webhook-mailer at python.org
Sat Oct 20 20:30:58 EDT 2018


https://github.com/python/cpython/commit/beb83d013e0295c987087febf2be78b1da389b15
commit: beb83d013e0295c987087febf2be78b1da389b15
branch: 3.6
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: GitHub <noreply at github.com>
date: 2018-10-20T17:30:54-07:00
summary:

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 94451182ccd6729c11338926d8a3d11645e86626)

Co-authored-by: Max Bélanger <aeromax at gmail.com>

files:
A Misc/NEWS.d/next/macOS/2018-10-18-23-54-55.bpo-35025.X4LFJg.rst
M Modules/timemodule.c

diff --git a/Misc/NEWS.d/next/macOS/2018-10-18-23-54-55.bpo-35025.X4LFJg.rst b/Misc/NEWS.d/next/macOS/2018-10-18-23-54-55.bpo-35025.X4LFJg.rst
new file mode 100644
index 000000000000..aebd1af9351c
--- /dev/null
+++ b/Misc/NEWS.d/next/macOS/2018-10-18-23-54-55.bpo-35025.X4LFJg.rst
@@ -0,0 +1,2 @@
+Properly guard the use of the ``CLOCK_GETTIME`` et al. macros in ``timemodule``
+on macOS.
diff --git a/Modules/timemodule.c b/Modules/timemodule.c
index f66f098740b2..6bb1ffb163d7 100644
--- a/Modules/timemodule.c
+++ b/Modules/timemodule.c
@@ -1350,6 +1350,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
@@ -1369,6 +1371,8 @@ PyInit_time(void)
     PyModule_AddIntMacro(m, CLOCK_THREAD_CPUTIME_ID);
 #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)



More information about the Python-checkins mailing list