#14961: Preparser not robust enough against typos
-------------------------------------------------+-------------------------
Reporter: tscrim | Owner: tscrim
Type: defect | Status:
Priority: critical | needs_work
Component: user interface | Milestone: sage-5.12
Keywords: | Resolution:
Authors: Travis Scrimshaw, Jeroen | Merged in:
Demeyer | Reviewers: Volker
Report Upstream: Reported upstream. Developers | Braun
acknowledge bug. | Work issues:
Branch: | Commit:
Dependencies: | Stopgaps:
-------------------------------------------------+-------------------------
Changes (by {'newvalue': u'Travis Scrimshaw, Jeroen Demeyer', 'oldvalue':
u'Travis Scrimshaw'}):
* status: positive_review => needs_work
* author: Travis Scrimshaw => Travis Scrimshaw, Jeroen Demeyer
Old description:
> I made a typo and sage crashed:
> {{{
> R.<t> = QQ{]
> }}}
> Note that there is one opening squigly bracket `{` and one closing square
> bracket `]`.
>
> Here's the backtrace
> {{{
> Traceback (most recent call last):
> File "/home/tscrim/sage-5.11.beta3/local/lib/python2.7/site-
> packages/IPython/core/application.py", line 175, in excepthook
> return self.crash_handler(etype, evalue, tb)
> File "/home/tscrim/sage-5.11.beta3/local/lib/python2.7/site-
> packages/IPython/core/crashhandler.py", line 178, in __call__
> raw_input("Hit <Enter> to quit (your terminal may close):")
> File "c_lib.pyx", line 70, in
> sage.ext.c_lib.sage_python_check_interrupt (sage/ext/c_lib.c:925)
> KeyboardInterrupt
>
> Original exception was:
> Traceback (most recent call last):
> File "/home/tscrim/sage-5.11.beta3/local/bin/sage-ipython", line 18, in
> <module>
> app.start()
> File "/home/tscrim/sage-5.11.beta3/local/lib/python2.7/site-
> packages/IPython/frontend/terminal/ipapp.py", line 363, in start
> self.shell.mainloop()
> File "/home/tscrim/sage-5.11.beta3/local/lib/python2.7/site-
> packages/IPython/frontend/terminal/interactiveshell.py", line 467, in
> mainloop
> self.interact(display_banner=display_banner)
> File "/home/tscrim/sage-5.11.beta3/local/lib/python2.7/site-
> packages/IPython/frontend/terminal/interactiveshell.py", line 579, in
> interact
> self.input_splitter.push(line)
> File "/home/tscrim/sage-5.11.beta3/local/lib/python2.7/site-
> packages/sage/misc/sage_extension.py", line 393, in push
> line = f(line, line_number)
> File "/home/tscrim/sage-5.11.beta3/local/lib/python2.7/site-
> packages/sage/misc/interpreter.py", line 271, in __call__
> return preparse(line, reset=(line_number==0))
> File "/home/tscrim/sage-5.11.beta3/local/lib/python2.7/site-
> packages/sage/misc/preparser.py", line 1112, in preparse
> L = preparse_generators(L)
> File "/home/tscrim/sage-5.11.beta3/local/lib/python2.7/site-
> packages/sage/misc/preparser.py", line 977, in preparse_generators
> opening = constructor.rindex('[')
> ValueError: substring not found
> }}}
New description:
I made a typo and sage crashed:
{{{
R.<t> = QQ{]
}}}
Note that there is one opening squigly bracket `{` and one closing square
bracket `]`.
Here's the backtrace
{{{
Traceback (most recent call last):
File "/home/tscrim/sage-5.11.beta3/local/lib/python2.7/site-
packages/IPython/core/application.py", line 175, in excepthook
return self.crash_handler(etype, evalue, tb)
File "/home/tscrim/sage-5.11.beta3/local/lib/python2.7/site-
packages/IPython/core/crashhandler.py", line 178, in __call__
raw_input("Hit <Enter> to quit (your terminal may close):")
File "c_lib.pyx", line 70, in sage.ext.c_lib.sage_python_check_interrupt
(sage/ext/c_lib.c:925)
KeyboardInterrupt
Original exception was:
Traceback (most recent call last):
File "/home/tscrim/sage-5.11.beta3/local/bin/sage-ipython", line 18, in
<module>
app.start()
File "/home/tscrim/sage-5.11.beta3/local/lib/python2.7/site-
packages/IPython/frontend/terminal/ipapp.py", line 363, in start
self.shell.mainloop()
File "/home/tscrim/sage-5.11.beta3/local/lib/python2.7/site-
packages/IPython/frontend/terminal/interactiveshell.py", line 467, in
mainloop
self.interact(display_banner=display_banner)
File "/home/tscrim/sage-5.11.beta3/local/lib/python2.7/site-
packages/IPython/frontend/terminal/interactiveshell.py", line 579, in
interact
self.input_splitter.push(line)
File "/home/tscrim/sage-5.11.beta3/local/lib/python2.7/site-
packages/sage/misc/sage_extension.py", line 393, in push
line = f(line, line_number)
File "/home/tscrim/sage-5.11.beta3/local/lib/python2.7/site-
packages/sage/misc/interpreter.py", line 271, in __call__
return preparse(line, reset=(line_number==0))
File "/home/tscrim/sage-5.11.beta3/local/lib/python2.7/site-
packages/sage/misc/preparser.py", line 1112, in preparse
L = preparse_generators(L)
File "/home/tscrim/sage-5.11.beta3/local/lib/python2.7/site-
packages/sage/misc/preparser.py", line 977, in preparse_generators
opening = constructor.rindex('[')
ValueError: substring not found
}}}
Apply [trac_14961-hack_fix_preparser-ts.patch] and
[attachment:14961_doctest.patch]
--
--
Ticket URL: <http://trac.sagemath.org/ticket/14961#comment:10>
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/groups/opt_out.