summaryrefslogtreecommitdiffstats
path: root/Python/pytime.c
diff options
context:
space:
mode:
authorBarry Warsaw <barry@python.org>2017-09-15 01:13:16 (GMT)
committerGitHub <noreply@github.com>2017-09-15 01:13:16 (GMT)
commitb2e5794870eb4728ddfaafc0f79a40299576434f (patch)
treeb625687bc81fd33c04fd83820e1276db92d9fa1a /Python/pytime.c
parentd384a81f557dab0b142bfcc9850bc68df46496ef (diff)
downloadcpython-b2e5794870eb4728ddfaafc0f79a40299576434f.zip
cpython-b2e5794870eb4728ddfaafc0f79a40299576434f.tar.gz
cpython-b2e5794870eb4728ddfaafc0f79a40299576434f.tar.bz2
bpo-31338 (#3374)
* Add Py_UNREACHABLE() as an alias to abort(). * Use Py_UNREACHABLE() instead of assert(0) * Convert more unreachable code to use Py_UNREACHABLE() * Document Py_UNREACHABLE() and a few other macros.
Diffstat (limited to 'Python/pytime.c')
-rw-r--r--Python/pytime.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/Python/pytime.c b/Python/pytime.c
index 7edb534..8f275d2 100644
--- a/Python/pytime.c
+++ b/Python/pytime.c
@@ -630,10 +630,7 @@ _PyTime_GetSystemClock(void)
_PyTime_t t;
if (pygettimeofday(&t, NULL, 0) < 0) {
/* should not happen, _PyTime_Init() checked the clock at startup */
- assert(0);
-
- /* use a fixed value instead of a random value from the stack */
- t = 0;
+ Py_UNREACHABLE();
}
return t;
}
@@ -663,7 +660,7 @@ pymonotonic(_PyTime_t *tp, _Py_clock_info_t *info, int raise)
return -1;
}
/* Hello, time traveler! */
- assert(0);
+ Py_UNREACHABLE();
}
*tp = t * MS_TO_NS;
@@ -771,10 +768,7 @@ _PyTime_GetMonotonicClock(void)
if (pymonotonic(&t, NULL, 0) < 0) {
/* should not happen, _PyTime_Init() checked that monotonic clock at
startup */
- assert(0);
-
- /* use a fixed value instead of a random value from the stack */
- t = 0;
+ Py_UNREACHABLE();
}
return t;
}