mirror of
https://github.com/python/cpython.git
synced 2025-12-04 00:30:19 +00:00
gh-109611: Add convenient C API function _PyFile_Flush() (GH-109612)
This commit is contained in:
parent
92af0cc580
commit
b8d1744e7b
11 changed files with 54 additions and 97 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue