def _(event: E) -> None:
        """
        Override Control-D exit, to ask for confirmation.
        """
        if python_input.confirm_exit:
            # Show exit confirmation and focus it (focusing is important for
            # making sure the default buffer key bindings are not active).
            python_input.show_exit_confirmation = True
            python_input.app.layout.focus(
                python_input.ptpython_layout.exit_confirmation
            )
        else:
            event.app.exit(exception=EOFError)

        Override Control-D exit, to ask for confirmation.
        
src/ptpython/key_bindings.py