On Thursday, October 24, 2019 at 8:39:00 AM UTC-7, John H Palmieri wrote:
>
>
> So maybe it should be on stderr, but it's not. Regarding 
> sys.stdout.flush(), my understanding, as confirmed by my experience with 
> this particular problem, is that this only flushes output coming from 
> Python, not from external library calls.
>

Ah right, because of python3 ditching clib output for some reason. you 
could try sys.stdout.buffer.flush() but I suspect that's not going to work 
either then (I am not familiar with how this stuff is implemented).

So you really want to interface with clib's fflush. 

with cython it's pretty clear how to do the interfacing. I guess via ctypes 
it would be possible too. I don't know if clib is already wrapped somewhere.

sage: cython("""from stdio cimport fflush
....: def cyflush():
....:     fflush(NULL)
....: """)

and then call cyflush() rather than stdout.flush()

(documentation  shows that fflush with NULL should flush all output)

This is getting a little heavy-handed for a doctest, but perhaps you like 
it better than patching FLINT

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-devel/0a6e432a-bf6f-4742-abba-dbedcad174e0%40googlegroups.com.

Reply via email to