Skip to content

Commit 285fcb9

Browse files
Handle errors from _PyTime_GetMonotonicClock() correctly.
1 parent 83aaef1 commit 285fcb9

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Modules/_testsinglephase.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,11 @@ init_state(module_state *state)
5959
state->str_const == NULL);
6060

6161
state->initialized = _PyTime_GetMonotonicClock();
62-
if (state->initialized < 0) {
62+
if (state->initialized == 0) {
63+
PyErr_SetString(PyExc_RuntimeError, "could not get current time");
6364
goto error;
6465
}
66+
assert(state->initialized > 0);
6567

6668
/* Add an exception type */
6769
state->error = PyErr_NewException("_testsinglephase.error", NULL, NULL);

0 commit comments

Comments
 (0)