Skip to content

The new REPL fails on Ctrl-C after search #123856

Closed
@serhiy-storchaka

Description

@serhiy-storchaka

How to reproduce:

  • Run the interactive interpreter.
  • Press <Ctrl-R>. You should see the "(r-search `')" prompt.
  • Press <Right>. You should see the normal REPL prompt ">>> ".
  • Press <Ctrl-C>. The REPL quits with a traceback.
>>> Traceback (most recent call last):nes[2::2]))
  File "/home/serhiy/py/cpython/Lib/_pyrepl/simple_interact.py", line 148, in run_multiline_interactive_console
    statement = multiline_input(more_lines, ps1, ps2)
  File "/home/serhiy/py/cpython/Lib/_pyrepl/readline.py", line 389, in multiline_input
    return reader.readline()
           ~~~~~~~~~~~~~~~^^
  File "/home/serhiy/py/cpython/Lib/_pyrepl/reader.py", line 800, in readline
    self.handle1()
    ~~~~~~~~~~~~^^
  File "/home/serhiy/py/cpython/Lib/_pyrepl/reader.py", line 755, in handle1
    self.console.wait(100)
    ~~~~~~~~~~~~~~~~~^^^^^
  File "/home/serhiy/py/cpython/Lib/_pyrepl/unix_console.py", line 426, in wait
    or bool(self.pollob.poll(timeout))
            ~~~~~~~~~~~~~~~~^^^^^^^^^
KeyboardInterrupt

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/serhiy/py/cpython/Lib/runpy.py", line 198, in _run_module_as_main
    return _run_code(code, main_globals, None,
                     "__main__", mod_spec)
  File "/home/serhiy/py/cpython/Lib/runpy.py", line 88, in _run_code
    exec(code, run_globals)
    ~~~~^^^^^^^^^^^^^^^^^^^
  File "/home/serhiy/py/cpython/Lib/_pyrepl/__main__.py", line 6, in <module>
    __pyrepl_interactive_console()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/serhiy/py/cpython/Lib/_pyrepl/main.py", line 59, in interactive_console
    run_multiline_interactive_console(console)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
  File "/home/serhiy/py/cpython/Lib/_pyrepl/simple_interact.py", line 165, in run_multiline_interactive_console
    r.pop_input_trans()
    ~~~~~~~~~~~~~~~~~^^
  File "/home/serhiy/py/cpython/Lib/_pyrepl/reader.py", line 559, in pop_input_trans
    self.input_trans = self.input_trans_stack.pop()
                       ~~~~~~~~~~~~~~~~~~~~~~~~~~^^
IndexError: pop from empty list

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.13bugs and security fixes3.14bugs and security fixestopic-replRelated to the interactive shell

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions