When writing a Python extension with C code, one can print to the python standard output and standard error streams using functions PySys_WriteStdout and PySys_WriteStderr, which work similarly to C's printf (https://docs.python.org/3/c-api/sys.html).
But after printing something through those functions, how can I flush the corresponding output stream? E.g. like C's fflush(stdout) and fflush(stderr).