Permalink
Browse files

Remove InteractiveShell's .buffer and .buffer_raw attributes, as well…

… as the .reset_buffer method.
  • Loading branch information...
1 parent 88b228c commit a6422a70e319d8664e35beea7b6e64b78cbaa5a9 @takluyver committed Apr 12, 2011
Showing with 3 additions and 32 deletions.
  1. +1 −19 IPython/core/interactiveshell.py
  2. +1 −12 IPython/core/prefilter.py
  3. +1 −1 IPython/frontend/terminal/interactiveshell.py
@@ -427,14 +427,6 @@ def init_instance_attrs(self):
# command compiler
self.compile = CachingCompiler()
-
- # User input buffers
- # NOTE: these variables are slated for full removal, once we are 100%
- # sure that the new execution logic is solid. We will delte runlines,
- # push_line and these buffers, as all input will be managed by the
- # frontends via an inputsplitter instance.
- self.buffer = []
- self.buffer_raw = []
# Make an empty namespace, which extension writers can rely on both
# existing and NEVER being used by ipython itself. This gives them a
@@ -1374,7 +1366,7 @@ def dummy_handler(self,etype,value,tb):
print 'Exception type :',etype
print 'Exception value:',value
print 'Traceback :',tb
- print 'Source code :','\n'.join(self.buffer)
+ #print 'Source code :','\n'.join(self.buffer)
if handler is None: handler = dummy_handler
@@ -2318,7 +2310,6 @@ def run_code(self, code_obj):
# Reset our crash handler in place
sys.excepthook = old_excepthook
except SystemExit:
- self.reset_buffer()
self.showtraceback(exception_only=True)
warn("To exit: use any of 'exit', 'quit', %Exit or Ctrl-D.", level=1)
except self.custom_exceptions:
@@ -2336,15 +2327,6 @@ def run_code(self, code_obj):
# For backwards compatibility
runcode = run_code
- def reset_buffer(self):
- """Reset the input buffer."""
- self.buffer[:] = []
- self.buffer_raw[:] = []
- self.input_splitter.reset()
-
- # For backwards compatibility
- resetbuffer = reset_buffer
-
#-------------------------------------------------------------------------
# Things related to GUI support and pylab
#-------------------------------------------------------------------------
@@ -383,10 +383,6 @@ def prefilter_line(self, line, continue_prompt=False):
# previously typed some whitespace that started a continuation
# prompt, he can break out of that loop with just an empty line.
# This is how the default python prompt works.
-
- # Only return if the accumulated input buffer was just whitespace!
- if ''.join(self.shell.buffer).isspace():
- self.shell.buffer[:] = []
return ''
# At this point, we invoke our transformers.
@@ -791,14 +787,7 @@ def handle(self, line_info):
if (continue_prompt and
self.shell.autoindent and
line.isspace() and
-
- (0 < abs(len(line) - self.shell.indent_current_nsp) <= 2
- or
- not self.shell.buffer
- or
- (self.shell.buffer[-1]).isspace()
- )
- ):
+ 0 < abs(len(line) - self.shell.indent_current_nsp) <= 2):
line = ''
return line
@@ -246,7 +246,7 @@ def interact(self, display_banner=None):
#double-guard against keyboardinterrupts during kbdint handling
try:
self.write('\nKeyboardInterrupt\n')
- self.resetbuffer()
+ self.input_splitter.reset()
more = False
except KeyboardInterrupt:
pass

0 comments on commit a6422a7

Please sign in to comment.