Carreau: can you rebase/repush. Travis is unhappy because GitHub was showing unicorns, and refuse to get restared. 
diff --git a/IPython/core/inputtransformer.py b/IPython/core/inputtransformer.py
index 9036add8a..3fdc64160 100644
--- a/IPython/core/inputtransformer.py
+++ b/IPython/core/inputtransformer.py
@@ -120,25 +120,18 @@ class TokenInputTransformer(InputTransformer):
     """
     def __init__(self, func):
         self.func = func
-        self.current_line = ""
-        self.line_used = False
+        self.buf = []
         self.reset_tokenizer()
-    
+
     def reset_tokenizer(self):
-        self.tokenizer = generate_tokens(self.get_line)
-    
-    def get_line(self):
-        if self.line_used:
-            raise TokenError
-        self.line_used = True
-        return self.current_line
-    
+        it = iter(self.buf)
+        self.tokenizer = generate_tokens(it.__next__)
+
     def push(self, line):
-        self.current_line += line + "\n"
-        if self.current_line.isspace():
+        self.buf.append(line + '\n')
+        if all(l.isspace() for l in self.buf):
             return self.reset()
-        
-        self.line_used = False
+
         tokens = []
         stop_at_NL = False
         try:
@@ -158,13 +151,13 @@ def push(self, line):
         return self.output(tokens)
     
     def output(self, tokens):
-        self.current_line = ""
+        self.buf.clear()
         self.reset_tokenizer()
         return untokenize(self.func(tokens)).rstrip('\n')
     
     def reset(self):
-        l = self.current_line
-        self.current_line = ""
+        l = ''.join(self.buf)
+        self.buf.clear()
         self.reset_tokenizer()
         if l:
             return l.rstrip('\n')

End of multiline string that contains a backslash-terminated line is not recognized
IPython 5.0/PTK1.0.5 does not recognize that

```
"""
foo\
bar
"""
```

is a full string and that it should execute the typed-in string after that point.

diff --git a/IPython/core/tests/test_inputtransformer.py b/IPython/core/tests/test_inputtransformer.py
index 27e67d8dd..2aa0670d5 100644
--- a/IPython/core/tests/test_inputtransformer.py
+++ b/IPython/core/tests/test_inputtransformer.py
@@ -389,6 +389,11 @@ def test_assemble_python_lines():
        (u"2,", None),
        (None, u"a = [1,\n2,"),
       ],
+      [(u"a = '''", None),  # Test line continuation within a multi-line string
+       (u"abc\\", None),
+       (u"def", None),
+       (u"'''", u"a = '''\nabc\\\ndef\n'''"),
+      ],
     ] + syntax_ml['multiline_datastructure']
     for example in tests:
         transform_checker(example, ipt.assemble_python_lines)

pip install -e .[test]
parse_log_pytest
requirements.txt
pytest pytest-cov pytest-xdist pytest-mock pytest-asyncio
apt-get update apt-get install -y gcc
3.6
requirements.txt
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
attrs==22.2.0
certifi==2021.5.30
charset-normalizer==2.0.12
coverage==6.2
decorator==5.1.1
entrypoints==0.4
execnet==1.9.0
idna==3.10
importlib-metadata==4.8.3
iniconfig==1.1.1
ipykernel==5.5.6
-e git+https://github.com/ipython/ipython.git@ee0571bd401ef1bd296c728b5436ff219097846f#egg=ipython
ipython-genutils==0.2.0
jsonschema==3.2.0
jupyter-client==7.1.2
jupyter-core==4.9.2
nbformat==5.1.3
nest-asyncio==1.6.0
nose==1.3.7
numpy==1.19.5
packaging==21.3
pexpect==4.9.0
pickleshare==0.7.5
pluggy==1.0.0
prompt-toolkit==1.0.18
ptyprocess==0.7.0
py==1.11.0
Pygments==2.14.0
pyparsing==3.1.4
pyrsistent==0.18.0
pytest==7.0.1
pytest-asyncio==0.16.0
pytest-cov==4.0.0
pytest-mock==3.6.1
pytest-xdist==3.0.2
python-dateutil==2.9.0.post0
pyzmq==25.1.2
requests==2.27.1
simplegeneric==0.8.1
six==1.17.0
testpath==0.6.0
tomli==1.2.3
tornado==6.1
traitlets==4.3.3
typing_extensions==4.1.1
urllib3==1.26.20
wcwidth==0.2.13
zipp==3.6.0

name: ipython
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - ca-certificates=2025.2.25=h06a4308_0
  - certifi=2021.5.30=py36h06a4308_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.3=he6710b0_2
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=1.1.1w=h7f8727e_0
  - pip=21.2.2=py36h06a4308_0
  - python=3.6.13=h12debd9_1
  - readline=8.2=h5eee18b_0
  - setuptools=58.0.4=py36h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - wheel=0.37.1=pyhd3eb1b0_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - attrs==22.2.0
      - charset-normalizer==2.0.12
      - coverage==6.2
      - decorator==5.1.1
      - entrypoints==0.4
      - execnet==1.9.0
      - idna==3.10
      - importlib-metadata==4.8.3
      - iniconfig==1.1.1
      - ipykernel==5.5.6
      - ipython-genutils==0.2.0
      - jsonschema==3.2.0
      - jupyter-client==7.1.2
      - jupyter-core==4.9.2
      - nbformat==5.1.3
      - nest-asyncio==1.6.0
      - nose==1.3.7
      - numpy==1.19.5
      - packaging==21.3
      - pexpect==4.9.0
      - pickleshare==0.7.5
      - pluggy==1.0.0
      - prompt-toolkit==1.0.18
      - ptyprocess==0.7.0
      - py==1.11.0
      - pygments==2.14.0
      - pyparsing==3.1.4
      - pyrsistent==0.18.0
      - pytest==7.0.1
      - pytest-asyncio==0.16.0
      - pytest-cov==4.0.0
      - pytest-mock==3.6.1
      - pytest-xdist==3.0.2
      - python-dateutil==2.9.0.post0
      - pyzmq==25.1.2
      - requests==2.27.1
      - simplegeneric==0.8.1
      - six==1.17.0
      - testpath==0.6.0
      - tomli==1.2.3
      - tornado==6.1
      - traitlets==4.3.3
      - typing-extensions==4.1.1
      - urllib3==1.26.20
      - wcwidth==0.2.13
      - zipp==3.6.0
prefix: /opt/conda/envs/ipython

IPython/core/tests/test_inputtransformer.py::test_assemble_python_lines
IPython/core/tests/test_inputtransformer.py::test_assign_system IPython/core/tests/test_inputtransformer.py::test_assign_magic IPython/core/tests/test_inputtransformer.py::test_classic_prompt IPython/core/tests/test_inputtransformer.py::test_ipy_prompt IPython/core/tests/test_inputtransformer.py::test_assemble_logical_lines IPython/core/tests/test_inputtransformer.py::test_help_end IPython/core/tests/test_inputtransformer.py::test_escaped_noesc IPython/core/tests/test_inputtransformer.py::test_escaped_shell IPython/core/tests/test_inputtransformer.py::test_escaped_help IPython/core/tests/test_inputtransformer.py::test_escaped_magic IPython/core/tests/test_inputtransformer.py::test_escaped_quote IPython/core/tests/test_inputtransformer.py::test_escaped_quote2 IPython/core/tests/test_inputtransformer.py::test_escaped_paren IPython/core/tests/test_inputtransformer.py::test_cellmagic IPython/core/tests/test_inputtransformer.py::test_has_comment IPython/core/tests/test_inputtransformer.py::test_token_input_transformer
IPython/core/inputtransformer.py
IPython/core/inputtransformer.py