summaryrefslogtreecommitdiffstats
path: root/Python/errors.c
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2023-09-23 06:35:30 (GMT)
committerGitHub <noreply@github.com>2023-09-23 06:35:30 (GMT)
commitb8d1744e7ba87a4057350fdfd788b5621095fc59 (patch)
tree367ba89c2a83a1115f74b1e0c83384e047ef4b84 /Python/errors.c
parent92af0cc580051fd1129c7a86af2cbadeb2aa36dc (diff)
downloadcpython-b8d1744e7ba87a4057350fdfd788b5621095fc59.zip
cpython-b8d1744e7ba87a4057350fdfd788b5621095fc59.tar.gz
cpython-b8d1744e7ba87a4057350fdfd788b5621095fc59.tar.bz2
gh-109611: Add convenient C API function _PyFile_Flush() (GH-109612)
Diffstat (limited to 'Python/errors.c')
-rw-r--r--Python/errors.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/Python/errors.c b/Python/errors.c
index e6fa15f..b05b3ef 100644
--- a/Python/errors.c
+++ b/Python/errors.c
@@ -1513,11 +1513,9 @@ write_unraisable_exc_file(PyThreadState *tstate, PyObject *exc_type,
}
/* Explicitly call file.flush() */
- PyObject *res = PyObject_CallMethodNoArgs(file, &_Py_ID(flush));
- if (!res) {
+ if (_PyFile_Flush(file) < 0) {
return -1;
}
- Py_DECREF(res);
return 0;
}