[Python-checkins] cpython (3.5): Issue #24707: Remove assertion in monotonic clock

victor.stinner python-checkins at python.org
Thu Sep 3 00:16:43 CEST 2015


https://hg.python.org/cpython/rev/4c90b4a4fffa
changeset: 97597:4c90b4a4fffa
branch: 3.5
parent: 97595:1afb86afe7a9
user: Victor Stinner <victor.stinner at gmail.com>
date: Thu Sep 03 00:13:46 2015 +0200
summary:
 Issue #24707: Remove assertion in monotonic clock
Don't check anymore at runtime that the monotonic clock doesn't go backward.
Yes, it happens. It occurs sometimes each month on a Debian buildbot slave
running in a VM.
The problem is that Python cannot do anything useful if a monotonic clock goes
backward. It was decided in the PEP 418 to not fix the system, but only expose
the clock provided by the OS.
files:
 Python/pytime.c | 10 ----------
 1 files changed, 0 insertions(+), 10 deletions(-)
diff --git a/Python/pytime.c b/Python/pytime.c
--- a/Python/pytime.c
+++ b/Python/pytime.c
@@ -533,10 +533,6 @@
 static int
 pymonotonic_new(_PyTime_t *tp, _Py_clock_info_t *info, int raise)
 {
-#ifdef Py_DEBUG
- static int last_set = 0;
- static _PyTime_t last = 0;
-#endif
 #if defined(MS_WINDOWS)
 ULONGLONG result;
 
@@ -628,12 +624,6 @@
 if (_PyTime_FromTimespec(tp, &ts, raise) < 0)
 return -1;
 #endif
-#ifdef Py_DEBUG
- /* monotonic clock cannot go backward */
- assert(!last_set || last <= *tp);
- last = *tp;
- last_set = 1;
-#endif
 return 0;
 }
 
-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /