Singular and SAGE_DEBUG fixes

Imported from <a href="http://trac.sagemath.org/sage_trac/ticket/13876">trac #13876</a>.

diff for review only

Reported by: vbraun

Component: packages

CC: 

Report Upstream: N/A

Authors: Volker Braun

Dependencies: 

Work issues: 

Reviewers: Simon King

Merged in: sage-5.7.beta0

Attachments: <ol><li><a href="http://trac.sagemath.org/sage_trac/attachment/ticket/13876/singular-p3.diff">singular-p3.diff: diff for review only</a> by vbraun at 20121228T12:38:10</li></ol>