gh-109611: Add convenient C API function _PyFile_Flush() (GH-109612)

This commit is contained in:
Serhiy Storchaka 2023-09-23 09:35:30 +03:00 • committed by GitHub
parent 92af0cc580
commit b8d1744e7b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 54 additions and 97 deletions

View file

@ -529,6 +529,18 @@ PyFile_OpenCode(const char *utf8path)
}
int
_PyFile_Flush(PyObject *file)
{
PyObject *tmp = PyObject_CallMethodNoArgs(file, &_Py_ID(flush));
if (tmp == NULL) {
return -1;
}
Py_DECREF(tmp);
return 0;
}
#ifdef __cplusplus
}
#endif