Skip to content

Commit 7b99519

Browse files
Update Modules/timemodule.c
Co-authored-by: Victor Stinner <[email protected]>
1 parent 1b6348a commit 7b99519

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Modules/timemodule.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -400,9 +400,9 @@ time_sleep(PyObject *self, PyObject *timeout_obj)
400400
PyTime_t timeout;
401401
if (_PyTime_FromSecondsObject(&timeout, timeout_obj, _PyTime_ROUND_TIMEOUT)) {
402402
if (PyErr_ExceptionMatches(PyExc_TypeError)) {
403-
const char *type_name = Py_TYPE(timeout_obj)->tp_name;
404-
PyObject* msg = PyUnicode_FromFormat("'%s' object cannot be interpreted as an integer or float", type_name);
405-
PyErr_SetString(PyExc_TypeError, PyUnicode_AsUTF8(msg));
403+
PyErr_Format(PyExc_TypeError,
404+
"'%T' object cannot be interpreted as an integer or float",
405+
timeout_obj);
406406
}
407407
return NULL;
408408
}

0 commit comments

Comments
 (0)