summaryrefslogtreecommitdiffstats
path: root/Modules/_threadmodule.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 /Modules/_threadmodule.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 'Modules/_threadmodule.c')
-rw-r--r--Modules/_threadmodule.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/Modules/_threadmodule.c b/Modules/_threadmodule.c
index 7692bac..9c91548 100644
--- a/Modules/_threadmodule.c
+++ b/Modules/_threadmodule.c
@@ -1497,11 +1497,9 @@ thread_excepthook_file(PyObject *file, PyObject *exc_type, PyObject *exc_value,
_PyErr_Display(file, exc_type, exc_value, exc_traceback);
/* 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;
}