#6661: [with patch, needs review] Misleading warning message of  _expect_expr() 
at
KeyboardInterrupt
------------------------+---------------------------------------------------
 Reporter:  SimonKing   |       Owner:  SimonKing        
     Type:  defect      |      Status:  assigned         
 Priority:  minor       |   Milestone:  sage-4.1.1       
Component:  interfaces  |    Keywords:  KeyboardInterrupt
 Reviewer:              |      Author:  Simon King       
   Merged:              |  
------------------------+---------------------------------------------------
Changes (by newvalueoldvalue):

  * author:  => Simon King


Old description:

> When there is a {{{KeyboardInterrupt}}} while {{{_expect_expr}}} talks
> with some interface, there is ''always'' the warning message
> {{{
> Control-C pressed.  Interrupting R. Please wait a few seconds...
> }}}
> before the {{{KeyboardInterrupt}}} is re-raised -- regardless whether the
> interface is R or anything else!
>
> The patch that I am about to post would instead print
> {{{
> "Control-C pressed.  Interrupting %s. Please wait a few seconds..."%self
> }}}
> where {{{self}}} is the interface.
>
> I know that all bug fixes should be doc tested. But can someone explain
> to me how one can produce a {{{KeyboardInterrupt}}} while
> {{{_expect_expr()}}} is running?

New description:

 When there is a {{{KeyboardInterrupt}}} while {{{_expect_expr}}} talks
 with some interface, there is ''always'' the warning message
 {{{
 Control-C pressed.  Interrupting R. Please wait a few seconds...
 }}}
 before the {{{KeyboardInterrupt}}} is re-raised -- regardless whether the
 interface is R or anything else!

 The patch that I am about to post would instead print
 {{{
 "Control-C pressed.  Interrupting %s. Please wait a few seconds..."%self
 }}}
 where {{{self}}} is the interface.

--

Comment:

 Meanwhile there also is a doc test (thank you for pointing me to the
 "alarm" function, William!), so, I think the patch is ready for review!

 Now, we have a better warning message:
 {{{
 sage: print sage0.eval("alarm(1); singular._expect_expr('1')")
 Control-C pressed.  Interrupting Singular. Please wait a few seconds...
 ---------------------------------------------------------------------------
 KeyboardInterrupt                         Traceback (most recent call
 last)

 /home/king/.sage/temp/gauss/29173/_home_king__sage_init_sage_0.py in
 <module>()

 /home/king/SAGE/sage-4.1/local/lib/python2.6/site-
 packages/sage/interfaces/expect.pyc in _expect_expr(self, expr, timeout)
     838                 else:
     839                     break
 --> 840             raise KeyboardInterrupt, msg
     841
     842     def _sendstr(self, str):

 KeyboardInterrupt: computation timed out because alarm was set for 1
 seconds
 sage: print sage0.eval("alarm(1); gap._expect_expr('1')")
 Control-C pressed.  Interrupting Gap. Please wait a few seconds...
 ---------------------------------------------------------------------------
 KeyboardInterrupt                         Traceback (most recent call
 last)

 /home/king/.sage/temp/gauss/29173/_home_king__sage_init_sage_0.py in
 <module>()

 /home/king/SAGE/sage-4.1/local/lib/python2.6/site-
 packages/sage/interfaces/expect.pyc in _expect_expr(self, expr, timeout)
     838                 else:
     839                     break
 --> 840             raise KeyboardInterrupt, msg
     841
     842     def _sendstr(self, str):

 KeyboardInterrupt: computation timed out because alarm was set for 1
 seconds
 }}}

 Note that it correctly says "Interrupting Singular" or "Interrupting Gap".

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/6661#comment:2>
Sage <http://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 post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to