Exploring terminfo

Grant Edwards grant.b.edwards at gmail.com
Fri Jan 15 21:43:40 EST 2021


On 2021-01-16, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
> On 16/01/21 7:33 am, Grant Edwards wrote:
>
>> Starting in Python 3.<something>, python's stdio file objects are _not_
>> on top of the libc FILE streams: they're directly on top of the file
>> descriptor.
>
> This sounds like rather a bad situation, because it means that
> any C library using stdio is going to interact badly with Python
> stdio.

True, but how many Python programs use C libraries that write to FILE*
streams and need to mix in Python "standard output"?

> Can something be done about this? Maybe Python stdio objects
> should flush all the C stdio streams before writing anything?

There's probably a way to hack the sys.stdout object to make it write
data to the FILE* stream using fwrite(), but it'd be ugly.

--
Grant




More information about the Python-list mailing list