Ticket #5052 (closed defect: fixed)
[with patch, positive review] preparser does not respect leading space in front of "load foo.sage"
| Reported by: | ddrake | Owned by: | cwitty |
|---|---|---|---|
| Priority: | major | Milestone: | sage-3.3 |
| Component: | misc | Keywords: | |
| Cc: | Work issues: | ||
| Report Upstream: | Reviewers: | ||
| Authors: | Merged in: | ||
| Dependencies: | Stopgaps: |
Description
If you have something like the following in a file:
try:
load foo.sage
except:
print 'uh oh'
it gets preparsed to this, and blows up because of the bad indentation:
try:
execfile("foo.py")
except:
print 'uh oh'
The preparser is not honoring the leading space before the load statement.
Attachments
Change History
comment:1 Changed 4 years ago by ddrake
- Summary changed from preparser does not respect leading space in front of "load foo.sage" to [with patch, needs review] preparser does not respect leading space in front of "load foo.sage"
comment:2 Changed 4 years ago by ddrake
The problem was in sage-preparse; it ran a lstrip() on the line and never took into consideration the indentation.
I wanted to add some doctests, since as we see here, anything not tested is broken -- do the files in $SAGE_ROOT/local/bin get doctested?
Note: See
TracTickets for help on using
tickets.

