Re: [sage-devel] Python 3 and flushing output from external libraries

2019-10-24 Thread Nils Bruin
On Thursday, October 24, 2019 at 11:23:02 AM UTC-7, Dima Pasechnik wrote: > > > I am thinking that having a cross-platform > > sage_ctypes=ctypes.cdll.LoadLibrary("...") > > mihgt be useful to have beyond 1 test... > I think so too, but if you google a bit you see there are various wrappers (i

Re: [sage-devel] Python 3 and flushing output from external libraries

2019-10-24 Thread Dima Pasechnik
On Thu, Oct 24, 2019 at 7:15 PM John H Palmieri wrote: > > > > On Thursday, October 24, 2019 at 10:57:09 AM UTC-7, Dima Pasechnik wrote: >> >> On Thu, Oct 24, 2019 at 6:48 PM Nils Bruin wrote: >> > >> > On Thursday, October 24, 2019 at 10:29:48 AM UTC-7, Nils Bruin wrote: >> >> >> >> >> >> I gues

Re: [sage-devel] Python 3 and flushing output from external libraries

2019-10-24 Thread John H Palmieri
On Thursday, October 24, 2019 at 10:57:09 AM UTC-7, Dima Pasechnik wrote: > > On Thu, Oct 24, 2019 at 6:48 PM Nils Bruin > > wrote: > > > > On Thursday, October 24, 2019 at 10:29:48 AM UTC-7, Nils Bruin wrote: > >> > >> > >> I guess via ctypes it would be possible too. > > > > > > Browsi

Re: [sage-devel] Python 3 and flushing output from external libraries

2019-10-24 Thread Dima Pasechnik
On Thu, Oct 24, 2019 at 6:48 PM Nils Bruin wrote: > > On Thursday, October 24, 2019 at 10:29:48 AM UTC-7, Nils Bruin wrote: >> >> >> I guess via ctypes it would be possible too. > > > Browsing the documentation, something like: > > libc=ctypes.cdll.LoadLibrary("libc.so.6") > libc.fflush(0r) > > sh

Re: [sage-devel] Python 3 and flushing output from external libraries

2019-10-24 Thread Nils Bruin
On Thursday, October 24, 2019 at 10:29:48 AM UTC-7, Nils Bruin wrote: > > > I guess via ctypes it would be possible too. > Browsing the documentation, something like: libc=ctypes.cdll.LoadLibrary("libc.so.6") libc.fflush(0r) should work. And this should cause way less overhead than calling cytho

Re: [sage-devel] Python 3 and flushing output from external libraries

2019-10-24 Thread Nils Bruin
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, no

Re: [sage-devel] Python 3 and flushing output from external libraries

2019-10-24 Thread John H Palmieri
On Wednesday, October 23, 2019 at 9:49:56 PM UTC-7, Nils Bruin wrote: > > On Wednesday, October 23, 2019 at 2:47:54 PM UTC-7, John H Palmieri wrote: >> >> >> >> On Wednesday, October 23, 2019 at 1:41:35 PM UTC-7, Nils Bruin wrote: >>> >>> On Wednesday, October 23, 2019 at 1:26:46 PM UTC-7, John C

Re: [sage-devel] Python 3 and flushing output from external libraries

2019-10-23 Thread Nils Bruin
On Wednesday, October 23, 2019 at 2:47:54 PM UTC-7, John H Palmieri wrote: > > > > On Wednesday, October 23, 2019 at 1:41:35 PM UTC-7, Nils Bruin wrote: >> >> On Wednesday, October 23, 2019 at 1:26:46 PM UTC-7, John Cremona wrote: >>> >>> >>> That all looks very complicated. Before I fixed the ecl

Re: [sage-devel] Python 3 and flushing output from external libraries

2019-10-23 Thread John H Palmieri
On Wednesday, October 23, 2019 at 1:41:35 PM UTC-7, Nils Bruin wrote: > > On Wednesday, October 23, 2019 at 1:26:46 PM UTC-7, John Cremona wrote: >> >> >> That all looks very complicated. Before I fixed the eclib source code >> the previous method did work, namely to flush stdout and stderr fro

Re: [sage-devel] Python 3 and flushing output from external libraries

2019-10-23 Thread Nils Bruin
On Wednesday, October 23, 2019 at 1:26:46 PM UTC-7, John Cremona wrote: > > > 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

Re: [sage-devel] Python 3 and flushing output from external libraries

2019-10-23 Thread John Cremona
On Wed, 23 Oct 2019 at 21:12, John H Palmieri 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. Other

Re: [sage-devel] Python 3 and flushing output from external libraries

2019-10-23 Thread John H Palmieri
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

Re: [sage-devel] Python 3 and flushing output from external libraries

2019-10-23 Thread Dima Pasechnik
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, wrote: > > > On Monday, September 9, 2019 at 2:06:21 PM UTC-7, Jeroen Demeyer wrote: >> >> On Mon,

Re: [sage-devel] Python 3 and flushing output from external libraries

2019-10-23 Thread John H Palmieri
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 > 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 (#2845

Re: [sage-devel] Python 3 and flushing output from external libraries

2019-09-10 Thread John Cremona
On Mon, 9 Sep 2019 at 22:52, John H Palmieri 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 >> wrote: >> > I am writing to ask for help fixing a Python 3 problem. On some >> platforms, there are Python 3 d

Re: [sage-devel] Python 3 and flushing output from external libraries

2019-09-09 Thread John H Palmieri
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 > 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 (#2845

Re: [sage-devel] Python 3 and flushing output from external libraries

2019-09-09 Thread Jeroen Demeyer
On Mon, Sep 9, 2019 at 7:51 PM John H Palmieri 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. Ar

[sage-devel] Python 3 and flushing output from external libraries

2019-09-09 Thread John H Palmieri
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) - rings/polynomial/polynomial_rational_flint.pyx (#28334) and both occur for the same reason: warning messages printed by C or C++ libraries are n