##// END OF EJS Templates
Separate InteractiveShell.input_splitter into two instances....
Thomas Kluyver -
Show More
@@ -283,10 +283,16 b' class InteractiveShell(SingletonConfigurable):'
283 283 filename = Unicode("<ipython console>")
284 284 ipython_dir= Unicode('', config=True) # Set to get_ipython_dir() in __init__
285 285
286 # Input splitter, to split entire cells of input into either individual
287 # interactive statements or whole blocks.
286 # Input splitter, to transform input line by line and detect when a block
287 # is ready to be executed.
288 288 input_splitter = Instance('IPython.core.inputsplitter.IPythonInputSplitter',
289 (), {})
289 (), {'line_input_checker': True})
290
291 # This InputSplitter instance is used to transform completed cells before
292 # running them. It allows cell magics to contain blank lines.
293 input_transformer_manager = Instance('IPython.core.inputsplitter.IPythonInputSplitter',
294 (), {'line_input_checker': False})
295
290 296 logstart = CBool(False, config=True, help=
291 297 """
292 298 Start logging to the default log file.
@@ -2581,10 +2587,9 b' class InteractiveShell(SingletonConfigurable):'
2581 2587 if silent:
2582 2588 store_history = False
2583 2589
2584 self.input_splitter.push(raw_cell)
2590 self.input_transformer_manager.push(raw_cell)
2591 cell = self.input_transformer_manager.source_reset()
2585 2592
2586 cell = self.input_splitter.source_reset()
2587
2588 2593 # Our own compiler remembers the __future__ environment. If we want to
2589 2594 # run code with a separate __future__ environment, use the default
2590 2595 # compiler
@@ -35,6 +35,14 b' in attributes of :class:`~IPython.core.inputsplitter.IPythonInputSplitter`:'
35 35 passed to these, but note that function and class *definitions* are still a
36 36 series of separate statements. IPython does not use any of these by default.
37 37
38 An InteractiveShell instance actually has two
39 :class:`~IPython.core.inputsplitter.IPythonInputSplitter` instances, as the
40 attributes :attr:`~IPython.core.interactiveshell.InteractiveShell.input_splitter`,
41 to tell when a block of input is complete, and
42 :attr:`~IPython.core.interactiveshell.InteractiveShell.input_transformer_manager`,
43 to transform complete cells. If you add a transformer, you should make sure that
44 it gets added to both.
45
38 46 Stateless transformations
39 47 -------------------------
40 48
General Comments 0
You need to be logged in to leave comments. Login now