]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
closes bpo-35025: Properly guard the `CLOCK_GETTIME` et al macros in timemodule.c...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Sun, 21 Oct 2018 00:41:38 +0000 (17:41 -0700)
committerGitHub <noreply@github.com>
Sun, 21 Oct 2018 00:41:38 +0000 (17:41 -0700)
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@gmail.com>
Misc/NEWS.d/next/macOS/2018-10-18-23-54-55.bpo-35025.X4LFJg.rst [new file with mode: 0644]
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 (file)
index 0000000..aebd1af
--- /dev/null
@@ -0,0 +1,2 @@
+Properly guard the use of the ``CLOCK_GETTIME`` et al. macros in ``timemodule``
+on macOS.
index 7264ad6167008e072d3cd03be1a198ffd7ca7ff1..cd287f595b14786f958eed3f78b197139915dfc7 100644 (file)
@@ -1700,6 +1700,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
@@ -1728,6 +1730,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)