python / python/cpython

F1 help mode in the REPL

オープン
#148,191 コメント 10 件 リアクション 0 件 担当者 1 名 GitHub で見る

@johnslavik がすでに取り組んでいます。

2026年4月12日 から。

3.13 3.14 3.15 stdlib topic-repl type-bug
主要言語
Python
スター
77.2k
フォーク
35.9k
PR マージ指標
PR 指標を取得中

説明

Bug report

Bug description:

I've recently discovered F1 key bind to enter help mode in the REPL and found some problems:

  1. Pressing F1 multiple times will "stack" help modes. If you press F1 3 times, you now have to exit 3 times.

  2. Whatever the buffer is, help mode will write immediately past the buffer:

    Image
  3. If you press F1 while tab-completing, help banner will glitch on top of the overlay and then the overlay will leak into help mode:

    Image
  4. If you enter paste mode (F3), enter help mode (F1), leave paste mode (F3), leave help mode (exit), you get back to paste mode (expected prompt mode). This looks similar to a lock ordering deadlock.

    If you enter help mode with help and then enter and leave paste mode, this doesn't happen and we're correctly back at prompt mode.

    There might be more edge cases to this (prompt strings getting confused, etc.).

F1 is not a suggested feature anywhere in the REPL (unless you, well, type help and read about F1 there), so it is very likely that people don't know it exists. I only found that it was mentioned in https://docs.python.org/3/whatsnew/3.13.html#a-better-interactive-interpreter and https://peps.python.org/pep-0762/.

We could build guardrails that F1 isn't re-entrant and is pressed at the right moment (which could be challenging to do from the UX perspective because error reporting overlays are disabled by default at the runtime level), but I'm not sure if it is worth the complexity.

The F1 binding appears to provide limited user value (help exists already) while introducing many state-management edge cases. I think the easiest fix to all these issues is to remove the ability to press F1 entirely.

The welcome banner always suggested typing help for help (typing help is the same--resorts to _sitebuiltins._Helper()--except help> isn't colorized then).

Unless F1 is worth keeping?

CPython versions tested on:

CPython main branch

Operating systems tested on:

macOS

Linked PRs
  • gh-121668

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。