On Wed, 23 Oct 2019 at 21:12, John H Palmieri <jhpalmier...@gmail.com>
wrote:

> I found that and
> https://stackoverflow.com/questions/5081657/how-do-i-prevent-a-c-shared-library-to-print-on-stdout-in-python
> and maybe other related items, but I couldn't figure out how to use them to
> fix this particular problem. Others will know what they're doing more than
> I do regarding a Python/Cython interface to an external library, so others
> might have more luck.
>

That all looks very complicated.  Before I fixed the eclib source code the
previous method did work, namely to flush stdout and stderr from the
c/python wrapper code after calling any library function (in some cases
this is certainly redundant, but in the case of eclib it was very hard for
anyone other than me to know which library functions might spit out some
error or warning message).  Somewhere in src/sage/libs/flint are the
wrapper functions which need this.

Otherwise we might hope that a FLINT developer is reading this (Hello
Bill!) and do what I did with eclib.


>
>
>
> On Wednesday, October 23, 2019 at 12:41:21 PM UTC-7, Dima Pasechnik wrote:
>>
>> an internet search finds
>>
>> https://stackoverflow.com/questions/4178614/suppressing-output-of-module-calling-outside-library
>>
>> is it what would work for us?
>>
>> On Wed, 23 Oct 2019, 20:06 John H Palmieri, <jhpalm...@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?
>>>>
>>>> > 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 guess that Sage could also do the flushing whenever we return
>>>> from a library API call.
>>>>
>>>
>>> This problem arises with polynomial_rational_flint.pyx (on Ubuntu and
>>> Debian but not OS X, for whatever reason). See
>>> https://trac.sagemath.org/ticket/28334. How can we do this flushing?
>>> The only other solution I can see is to patch FLINT, but this won't work if
>>> users are using a system-wide installation of FLINT.
>>>
>>> Other flushing problems appear at #28454, now since fixed with an
>>> upgrade to eclib, and #28622: pure Python code, so adding some
>>> `sys.stdout.flush()` commands cleared up that problem. But the FLINT
>>> problem remains.
>>>
>>> --
>>> John
>>>
>>> --
>>> 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-...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/sage-devel/bc6e7a4a-c8a3-4511-94ec-718e0126b19e%40googlegroups.com
>>> <https://groups.google.com/d/msgid/sage-devel/bc6e7a4a-c8a3-4511-94ec-718e0126b19e%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/73733782-6706-4839-a1ec-1477287dd112%40googlegroups.com
> <https://groups.google.com/d/msgid/sage-devel/73733782-6706-4839-a1ec-1477287dd112%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/CAD0p0K4YiywDWu22FR_FKXdWuoW4Pz7c9aXN-%2BQAWnPG6%2Bw0OQ%40mail.gmail.com.

Reply via email to