We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1b6348a commit 7b99519Copy full SHA for 7b99519
Modules/timemodule.c
@@ -400,9 +400,9 @@ time_sleep(PyObject *self, PyObject *timeout_obj)
400
PyTime_t timeout;
401
if (_PyTime_FromSecondsObject(&timeout, timeout_obj, _PyTime_ROUND_TIMEOUT)) {
402
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));
+ PyErr_Format(PyExc_TypeError,
+ "'%T' object cannot be interpreted as an integer or float",
+ timeout_obj);
406
}
407
return NULL;
408
0 commit comments