From aee8eb34f9e94f1c8dd27fa3b8c041836cf325ae Mon Sep 17 00:00:00 2001 From: Petr Viktorin Date: Wed, 23 Aug 2023 11:48:48 +0200 Subject: [PATCH] Add error handling for time.sleep audit event --- Modules/timemodule.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Modules/timemodule.c b/Modules/timemodule.c index 68948b6be1a61a2..9cd10d4afea8527 100644 --- a/Modules/timemodule.c +++ b/Modules/timemodule.c @@ -414,7 +414,9 @@ Return the clk_id of a thread's CPU time clock."); static PyObject * time_sleep(PyObject *self, PyObject *timeout_obj) { - PySys_Audit("time.sleep", "O", timeout_obj); + if (PySys_Audit("time.sleep", "O", timeout_obj) < 0) { + return NULL; + } _PyTime_t timeout; if (_PyTime_FromSecondsObject(&timeout, timeout_obj, _PyTime_ROUND_TIMEOUT))