Skip to content

Commit 2793964

Browse files
committed
Fix the comment about the file parameter.
1 parent 4c339f3 commit 2793964

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

Python/errors.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1445,12 +1445,14 @@ make_unraisable_hook_args(PyThreadState *tstate, PyObject *exc_type,
14451445
14461446
It can be called to log the exception of a custom sys.unraisablehook.
14471447
1448-
Do nothing if sys.stderr attribute doesn't exist or is set to None. */
1448+
This assumes file is non-NULL.
1449+
*/
14491450
static int
14501451
write_unraisable_exc_file(PyThreadState *tstate, PyObject *exc_type,
14511452
PyObject *exc_value, PyObject *exc_tb,
14521453
PyObject *err_msg, PyObject *obj, PyObject *file)
14531454
{
1455+
assert(file != NULL && !Py_IsNone(file));
14541456
if (obj != NULL && obj != Py_None) {
14551457
if (err_msg != NULL && err_msg != Py_None) {
14561458
if (PyFile_WriteObject(err_msg, file, Py_PRINT_RAW) < 0) {

0 commit comments

Comments
 (0)