#6729: notebook -- bug when input contains uniform leading space
----------------------+-----------------------------------------------------
 Reporter:  was       |       Owner:  boothby   
     Type:  defect    |      Status:  new       
 Priority:  major     |   Milestone:  sage-4.1.2
Component:  notebook  |    Keywords:            
 Reviewer:            |      Author:            
   Merged:            |  
----------------------+-----------------------------------------------------

Comment(by was):

 Dorian's remarks:
 {{{
 Evaluating Kiran's CELL 1 in a codenode python notebook returns a similar
 error:

   File "<input>", line 1
     u = 2+3
    ^
 IndentationError: unexpected indent

 I don't think this is a sign of any bug, it is simply bad Python syntax.
 It doesn't make sense to exec something with leading white space with no
 preceding lines.

 One interesting clue to add to William's investigation... If you strip the
 leading white space of the first line, and evaluate in codenode, you get
 this:

 CELL 1:
 2+2
    2+3

 OUTPUT 1:
 4
   File "<input>", line 1
     2+3
    ^
 IndentationError: unexpected indent


 In the sage notebook, the output of the same input is "4" *without* the
 IndentationError statement, the same as the result in question (when the
 first line has 3 initial white spaces).

 This must have to do with sage pre-parsing out the white space of the
 initial line. In codenode, valid command blocks are built up (similar to
 sage, have look at _runcommands if you want). A cell may contain one or
 more valid commands. The interpreter processes the input looking for
 complete commands to compile. Once it has a complete command, it pauses
 processing the raw input, execs that command, and then resumes processing
 the raw input until it has all been compiled and exec'd.

 So, the experiment I showed in codenode (above, no leading white space on
 the first line) shows that the first line is a valid and complete command,
 and the second line is not.
 This is consistent with sage pre-parsing out the leading white space of
 the first line, and then maybe not printing the IndentationError, which
 shows up in codenode and the regular Python CLI.

 What do you all think?
 }}}

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/6729#comment:1>
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