#11542: Fix preparse_file to prevent constants from being assigned to
-------------------------------------+-------------------------------------
Reporter: nbruin | Owner: was
Type: defect | Status: needs_review
Priority: major | Milestone: sage-6.4
Component: user interface | Resolution:
Keywords: | Merged in:
Authors: Martin von Gagern | Reviewers:
Report Upstream: N/A | Work issues:
Branch: | Commit:
u/gagern/ticket/11542 | c8375cad159f50605c07da1447afc0ff1f6607b1
Dependencies: | Stopgaps:
-------------------------------------+-------------------------------------
Comment (by nbruin):
I haven't checked or tested the approach at all, so I cannot comment on
that. I did notice
{{{
try:
...
except:
print ...
raise
}}}
Unfortunately, that's a bad idea. The normal behaviour is that during
exception raising, nothing is printed. Only once the exception reaches the
REPL top level does the traceback get printed, and in a way that is
subject to hooks.
Printing something that belongs in the traceback could get lost (if stdout
is not stderr) or reach an inappropriate location (imagine that this
routine itself is run inside a try/except where the exception is supposed
to be caught).
I think the better solution here is to test if the failure of the "try"
body is in the way that warrants the information contained in "print" and
then raise an appropriate, new exception with an informative message
(possibly with bits extracted from the original exception) and otherwise
just raise, without printing new information.
If the "try" body fails in an expected way then the traceback from there
shouldn't be relevant, so a fresh exception is OK. Otherwise the exception
should appear uncaught.
--
Ticket URL: <http://trac.sagemath.org/ticket/11542#comment:17>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.