From 7aae6ea82d076861da1f70be31e384a6647b69ca 2014-02-02 01:30:45 From: Thomas Kluyver Date: 2014-02-02 01:30:45 Subject: [PATCH] Document changes to input transformers --- diff --git a/docs/source/config/inputtransforms.rst b/docs/source/config/inputtransforms.rst index a28c13d..1f9347f 100644 --- a/docs/source/config/inputtransforms.rst +++ b/docs/source/config/inputtransforms.rst @@ -43,6 +43,14 @@ to tell when a block of input is complete, and to transform complete cells. If you add a transformer, you should make sure that it gets added to both. +These transformers may raise :exc:`SyntaxError` if the input code is invalid, but +in most cases it is clearer to pass unrecognised code through unmodified and let +Python's own parser decide whether it is valid. + +.. versionchanged:: 2.0 + + Added the option to raise :exc:`SyntaxError`. + Stateless transformations ------------------------- diff --git a/docs/source/whatsnew/pr/incompat-inputsplitter-source-raw-reset.rst b/docs/source/whatsnew/pr/incompat-inputsplitter-source-raw-reset.rst new file mode 100644 index 0000000..7e9056f --- /dev/null +++ b/docs/source/whatsnew/pr/incompat-inputsplitter-source-raw-reset.rst @@ -0,0 +1,6 @@ +* :class:`IPython.core.inputsplitter.IPythonInputSplitter` no longer has a method + ``source_raw_reset()``, but gains :meth:`~IPython.core.inputsplitter.IPythonInputSplitter.raw_reset` + instead. Use of ``source_raw_reset`` can be replaced with:: + + raw = isp.source_raw + transformed = isp.source_reset() diff --git a/docs/source/whatsnew/pr/inputtransformer-syntaxerrors.rst b/docs/source/whatsnew/pr/inputtransformer-syntaxerrors.rst new file mode 100644 index 0000000..74d3594 --- /dev/null +++ b/docs/source/whatsnew/pr/inputtransformer-syntaxerrors.rst @@ -0,0 +1,4 @@ +* Input transformers (see :doc:`/config/inputtransforms`) may now raise + :exc:`SyntaxError` if they determine that input is invalid. The input + transformation machinery in IPython will handle displaying the exception to + the user and resetting state.