Opened 10 years ago

Closed 10 years ago

#13867 closed enhancement (fixed)

Remove debugging output from Python command line

Reported by: Jean-Pierre Flori Owned by: tbd
Priority: major Milestone: sage-5.7
Component: packages: standard Keywords: python spkg debug
Cc: Burcin Erocal, Volker Braun, Simon King Merged in: sage-5.7.beta4
Authors: Volker Braun Reviewers: Jean-Pierre Flori
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description (last modified by Volker Braun)

The extra debugging output "[number of refs]" before each command line prompt breaks the pynad build. the problem is that the test used by the AX_PYTHON_DEVEL autoconf macro to check for distutils fails when Python is built with pydebug.

Also, breaks the Sage test suite.

I'm just removing this extra output. Its not that useful, really, since object counts in Sage are always pretty large and widely fluctuating with stuff like coercion running in the background. It also doesn't offer any extra info over gc.get_count().

Install http://www.stp.dias.ie/~vbraun/Sage/spkg/python-2.7.3.p5.spkg

Attachments (1)

python-p5.patch (1.6 KB) - added by Volker Braun 10 years ago.
diff for review only

Download all attachments as: .zip

Change History (28)

comment:1 Changed 10 years ago by Volker Braun

I'm thinking we should just patch Python to not print out extra crap. Otherwise we have basically no hope of running the Sage doctests, no?

comment:2 Changed 10 years ago by Jean-Pierre Flori

Good point. And that should be even easier.

comment:3 Changed 10 years ago by Jean-Pierre Flori

In fact I do not really agree, especially now that I've checked that the crappy additional Python output does not pertub the doctest framework (surely because its spit on stderr and not stdout).

comment:4 Changed 10 years ago by Volker Braun

Surely the sage pexpect interface to itself will not work. Or various checks in sage.tests.cmdline that check that stderr is empty.

comment:5 Changed 10 years ago by Volker Braun

Authors: Volker Braun
Description: modified (diff)
Keywords: python added; pynac removed
Status: newneeds_review
Summary: Fix Pynac spkg so that it builds on top of a debug build of pythonRemove debugging output from Python command line

I'm taking over this ticket to patch up python

comment:6 Changed 10 years ago by Volker Braun

Description: modified (diff)

comment:7 Changed 10 years ago by Simon King

Just to be on the safe side: To use this one with SAGE_DEBUG=yes on top of an existing Sage install, one needs to install this new python spkg, then (re-)install the new cython spkg from #13832, and then sage -ba, right?

comment:8 Changed 10 years ago by Volker Braun

to get a working Sage you also need a patch to the Sage library (will post here soon) and a fixed Singular spkg... stay tuned ;-)

comment:9 Changed 10 years ago by Volker Braun

Patch to the Sage library is at #13868

comment:10 Changed 10 years ago by Simon King

We now have an abundance of tickets needed to make SAGE_DEBUG work. Shouldn't there be a meta-ticket, listing all relevant single-purpose tickets (#13876, #13867, #13868, #13832, #13864, and what else)?

comment:11 Changed 10 years ago by Volker Braun

#13864 is now the meta-ticket.

comment:12 in reply to:  10 ; Changed 10 years ago by Simon King

Replying to SimonKing:

We now have an abundance of tickets needed to make SAGE_DEBUG work. Shouldn't there be a meta-ticket, listing all relevant single-purpose tickets (#13876, #13867, #13868, #13832, #13864, and what else)?

FWIW: I created a metaticket at #13877.

comment:13 in reply to:  12 Changed 10 years ago by Simon King

Replying to SimonKing:

Replying to SimonKing:

We now have an abundance of tickets needed to make SAGE_DEBUG work. Shouldn't there be a meta-ticket, listing all relevant single-purpose tickets (#13876, #13867, #13868, #13832, #13864, and what else)?

FWIW: I created a metaticket at #13877.

OK, forget about that, Volker was faster with his change to #13864.

comment:14 Changed 10 years ago by Jeroen Demeyer

In spkg-install, are you sure you don't mean CFLAGS and/or CXXFLAGS instead CPPFLAGS? Because CPPFLAGS normally means "C preprocessor flags".

comment:15 Changed 10 years ago by Jeroen Demeyer

Dependencies: #13864

comment:16 Changed 10 years ago by Jeroen Demeyer

Dependencies: #13864

comment:17 Changed 10 years ago by Volker Braun

The spkg-install already used CPPFLAGS before I edited it, so I stuck with it. It does get picked up on the gcc command line, fwiw.

comment:18 Changed 10 years ago by Jeroen Demeyer

Status: needs_reviewneeds_work

Yes, it does use CPPFLAGS for its intended purpose. The -I option is related to preprocessing and belongs in $CPPFLAGS. Flags like -g or -O0 do not.

Note that adding -I$SAGE_LOCAL/include to CPPFLAGS is actually unneeded since that path gets picked up automatically because of the $CPATH environment variable. So you might as well remove

CPPFLAGS="-I$SAGE_LOCAL/include $CPPFLAGS"
export CPPFLAGS

comment:19 in reply to:  17 Changed 10 years ago by Jeroen Demeyer

Replying to vbraun:

The spkg-install already used CPPFLAGS before I edited it

It also uses CFLAGS by the way:

export CFLAGS="$CFLAGS `testcflags.sh -fwrapv`"

comment:20 Changed 10 years ago by Jean-Pierre Flori

I'm ok with the solution Volker proposes, we don't need that "extra" output, but I still think that Pynac should be able to deal with a vanilla Python debug build. So I'm just posting that here so that Burcin can take notice (I'll post on pynac-devel as well).

Changed 10 years ago by Volker Braun

Attachment: python-p5.patch added

diff for review only

comment:21 Changed 10 years ago by Volker Braun

I've removed the superfluous CPPFLAGS. Also --with-pydebug implies -O0 -g so we don't have to set it by hand.

comment:22 Changed 10 years ago by Volker Braun

Status: needs_workneeds_review

comment:23 Changed 10 years ago by Simon King

I use the package successfully with SAGE_DEBUG=yes.

Some criticism: SPKG.txt contains a section "Patches", but the new patch disable_print_refs_debug.patch is not mentioned.

The content of environment variables is sometimes tested like

if ["x$SAGE_DEBUG"="xyes"]; then

if I am not mistaken, but here it is

if ["$SAGE_DEBUG"="yes"]; then

Is that a problem?

comment:24 Changed 10 years ago by Volker Braun

I've added a line documenting the disable_print_refs_debug.patch

The xyes thing is a historical artifact.

comment:25 Changed 10 years ago by Jean-Pierre Flori

Reviewers: Jean-Pierre Flori
Status: needs_reviewpositive_review

Looks good.

If you really wants me to rant, I'd say:

  • first, there is a useless line at the end of the new patch for some emacs generated tmp file.
  • or even less problematic, you could remove the historical artifacts from spkg-install while you're at it.

comment:26 Changed 10 years ago by Jeroen Demeyer

Server down :-(

comment:27 Changed 10 years ago by Jeroen Demeyer

Merged in: sage-5.7.beta4
Resolution: fixed
Status: positive_reviewclosed
Note: See TracTickets for help on using tickets.