On Mon, 9 Sep 2019 at 22:52, John H Palmieri <jhpalmier...@gmail.com> wrote:
> > > On Monday, September 9, 2019 at 2:06:21 PM UTC-7, Jeroen Demeyer wrote: >> >> On Mon, Sep 9, 2019 at 7:51 PM John H Palmieri <jhpalm...@gmail.com> >> wrote: >> > I am writing to ask for help fixing a Python 3 problem. On some >> platforms, there are Python 3 doctest failures in >> > >> > - libs/eclib/interface.py (#28454) >> >> I believe that this has been fixed upstream, it has certainly been >> reported by me. Are we using the latest eclib version? >> > > John Cremona is part of the discussion at #28454, and I assume he knows > the current state of eclib. I'll let him speak to this. > Until yesterday it was not the case that eclib flushed all output in error situations such as the ones relevant here. I spent time yesterday dealing with that, and the next eclib version will have this desirable property. I hope to have the new verson Sage-ready very soon. I think that Jeroen is remembering a similar situation which happened before, where we managed to avoid the problem by doing the flushing from within the Sage-eclib interface (e.g. see line 203 of sage.libs.eclib.wrap.cpp). Such methods could probably be used again here, as a shorter fix for (the eclib part of) this issue. But JHP's question was a broader one. Since we cannot trust these C/C++ libraries to flush their output, the wrapping code in Sage must do it. I think this is better than patching the upstream sources, and will go off to #28454 to suggest this. John > > >> > How do we fix this? Note that patching FLINT is not ideal, since it >> won't help users who are using the system's version of the library. FLINT's >> most recent release was in 2015, so I don't know how much we can expect >> from upstream regarding new releases. So maybe the ideal solution would be >> to get Python to flush the output from these external libraries. I don't >> know how to do this; can anyone else help? >> >> Ideally, the upstream library should properly flush when producing >> output. They should use fflush (in C) or std::endl or std::flush (in >> C++). > > > I can confirm that patching flint to use fflush fixes the problem, and > similarly for eclib. Patching is not ideal, though, since we are trying to > move to better support libraries installed system-wide. > > >> I guess that Sage could also do the flushing whenever we return >> from a library API call. >> > > Sounds okay to me, but I don't know how to do it. My impression is that > `sys.stdout.flush()` just flushes Python output, not output coming from > external libraries. > > -- > 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/4df27a03-a625-47bb-ad4c-f2580f4b1298%40googlegroups.com > <https://groups.google.com/d/msgid/sage-devel/4df27a03-a625-47bb-ad4c-f2580f4b1298%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- 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/CAD0p0K5%3D-5bNnL%2B%3DF7u7CZmusADzEdogU6n5zKZuQF-fLEkv%2BQ%40mail.gmail.com.