Show More
@@ -427,14 +427,6 b' class InteractiveShell(Configurable, Magic):' | |||||
427 |
|
427 | |||
428 | # command compiler |
|
428 | # command compiler | |
429 | self.compile = CachingCompiler() |
|
429 | self.compile = CachingCompiler() | |
430 |
|
||||
431 | # User input buffers |
|
|||
432 | # NOTE: these variables are slated for full removal, once we are 100% |
|
|||
433 | # sure that the new execution logic is solid. We will delte runlines, |
|
|||
434 | # push_line and these buffers, as all input will be managed by the |
|
|||
435 | # frontends via an inputsplitter instance. |
|
|||
436 | self.buffer = [] |
|
|||
437 | self.buffer_raw = [] |
|
|||
438 |
|
430 | |||
439 | # Make an empty namespace, which extension writers can rely on both |
|
431 | # Make an empty namespace, which extension writers can rely on both | |
440 | # existing and NEVER being used by ipython itself. This gives them a |
|
432 | # existing and NEVER being used by ipython itself. This gives them a | |
@@ -1374,7 +1366,7 b' class InteractiveShell(Configurable, Magic):' | |||||
1374 | print 'Exception type :',etype |
|
1366 | print 'Exception type :',etype | |
1375 | print 'Exception value:',value |
|
1367 | print 'Exception value:',value | |
1376 | print 'Traceback :',tb |
|
1368 | print 'Traceback :',tb | |
1377 | print 'Source code :','\n'.join(self.buffer) |
|
1369 | #print 'Source code :','\n'.join(self.buffer) | |
1378 |
|
1370 | |||
1379 | if handler is None: handler = dummy_handler |
|
1371 | if handler is None: handler = dummy_handler | |
1380 |
|
1372 | |||
@@ -2318,7 +2310,6 b' class InteractiveShell(Configurable, Magic):' | |||||
2318 | # Reset our crash handler in place |
|
2310 | # Reset our crash handler in place | |
2319 | sys.excepthook = old_excepthook |
|
2311 | sys.excepthook = old_excepthook | |
2320 | except SystemExit: |
|
2312 | except SystemExit: | |
2321 | self.reset_buffer() |
|
|||
2322 | self.showtraceback(exception_only=True) |
|
2313 | self.showtraceback(exception_only=True) | |
2323 | warn("To exit: use any of 'exit', 'quit', %Exit or Ctrl-D.", level=1) |
|
2314 | warn("To exit: use any of 'exit', 'quit', %Exit or Ctrl-D.", level=1) | |
2324 | except self.custom_exceptions: |
|
2315 | except self.custom_exceptions: | |
@@ -2336,15 +2327,6 b' class InteractiveShell(Configurable, Magic):' | |||||
2336 | # For backwards compatibility |
|
2327 | # For backwards compatibility | |
2337 | runcode = run_code |
|
2328 | runcode = run_code | |
2338 |
|
2329 | |||
2339 | def reset_buffer(self): |
|
|||
2340 | """Reset the input buffer.""" |
|
|||
2341 | self.buffer[:] = [] |
|
|||
2342 | self.buffer_raw[:] = [] |
|
|||
2343 | self.input_splitter.reset() |
|
|||
2344 |
|
||||
2345 | # For backwards compatibility |
|
|||
2346 | resetbuffer = reset_buffer |
|
|||
2347 |
|
||||
2348 | #------------------------------------------------------------------------- |
|
2330 | #------------------------------------------------------------------------- | |
2349 | # Things related to GUI support and pylab |
|
2331 | # Things related to GUI support and pylab | |
2350 | #------------------------------------------------------------------------- |
|
2332 | #------------------------------------------------------------------------- |
@@ -383,10 +383,6 b' class PrefilterManager(Configurable):' | |||||
383 | # previously typed some whitespace that started a continuation |
|
383 | # previously typed some whitespace that started a continuation | |
384 | # prompt, he can break out of that loop with just an empty line. |
|
384 | # prompt, he can break out of that loop with just an empty line. | |
385 | # This is how the default python prompt works. |
|
385 | # This is how the default python prompt works. | |
386 |
|
||||
387 | # Only return if the accumulated input buffer was just whitespace! |
|
|||
388 | if ''.join(self.shell.buffer).isspace(): |
|
|||
389 | self.shell.buffer[:] = [] |
|
|||
390 | return '' |
|
386 | return '' | |
391 |
|
387 | |||
392 | # At this point, we invoke our transformers. |
|
388 | # At this point, we invoke our transformers. | |
@@ -791,14 +787,7 b' class PrefilterHandler(Configurable):' | |||||
791 | if (continue_prompt and |
|
787 | if (continue_prompt and | |
792 | self.shell.autoindent and |
|
788 | self.shell.autoindent and | |
793 | line.isspace() and |
|
789 | line.isspace() and | |
794 |
|
790 | 0 < abs(len(line) - self.shell.indent_current_nsp) <= 2): | ||
795 | (0 < abs(len(line) - self.shell.indent_current_nsp) <= 2 |
|
|||
796 | or |
|
|||
797 | not self.shell.buffer |
|
|||
798 | or |
|
|||
799 | (self.shell.buffer[-1]).isspace() |
|
|||
800 | ) |
|
|||
801 | ): |
|
|||
802 | line = '' |
|
791 | line = '' | |
803 |
|
792 | |||
804 | return line |
|
793 | return line |
@@ -246,7 +246,7 b' class TerminalInteractiveShell(InteractiveShell):' | |||||
246 | #double-guard against keyboardinterrupts during kbdint handling |
|
246 | #double-guard against keyboardinterrupts during kbdint handling | |
247 | try: |
|
247 | try: | |
248 | self.write('\nKeyboardInterrupt\n') |
|
248 | self.write('\nKeyboardInterrupt\n') | |
249 |
self.reset |
|
249 | self.input_splitter.reset() | |
250 | more = False |
|
250 | more = False | |
251 | except KeyboardInterrupt: |
|
251 | except KeyboardInterrupt: | |
252 | pass |
|
252 | pass |
General Comments 0
You need to be logged in to leave comments.
Login now