##// END OF EJS Templates
Fix bug where inputsplitter could enter an infinite loop.
Fernando Perez -
Show More
@@ -384,6 +384,7 b' class InputSplitter(object):'
384 lines = lines.splitlines()[::-1]
384 lines = lines.splitlines()[::-1]
385 # Outer loop over all input
385 # Outer loop over all input
386 while lines:
386 while lines:
387 #print 'Current lines:', lines # dbg
387 # Inner loop to build each block
388 # Inner loop to build each block
388 while True:
389 while True:
389 # Safety exit from inner loop
390 # Safety exit from inner loop
@@ -413,8 +414,10 b' class InputSplitter(object):'
413 # dedent happens, so , we consume the line and we can break out
414 # dedent happens, so , we consume the line and we can break out
414 # to start a new block.
415 # to start a new block.
415
416
416 # Case 1, explicit dedent causes a break
417 # Case 1, explicit dedent causes a break.
417 if _full_dedent and not next_line.startswith(' '):
418 # Note: check that we weren't on the very last line, else we'll
419 # enter an infinite loop adding/removing the last line.
420 if _full_dedent and lines and not next_line.startswith(' '):
418 lines.append(next_line)
421 lines.append(next_line)
419 break
422 break
420
423
General Comments 0
You need to be logged in to leave comments. Login now