Difference in Ctrl+D Behavior Between REPL and `code.interact`
オープン
まだ誰も着手していません。
stdlib
type-bug
- 主要言語
- Python
- スター
- 77.2k
- フォーク
- 35.9k
- PR マージ指標
- PR 指標を取得中
説明
Bug report
Bug description:
With #133883 merged, hitting ctrl+d at the start of a blank line in a multi-line entry causes the existing code to be evaluated in both the new REPL and the basic REPL:
>>> def foo(x):
...
File "<python-input-0>", line 1
def foo(x):
^
IndentationError: expected an indented block after function definition on line 1
But code.interact() exits immediately without executing the existing code:
>>> def foo(x):
...
now exiting InteractiveConsole...
I doubt this is terribly impactful, but I think it would still be nice to have these behave the same way.
I have a patch ready that I think will resolve this, so I'll open a PR shortly.
CPython versions tested on:
CPython main branch
Operating systems tested on:
Linux
Linked PRs
- gh-139876
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
まず、issue にある空行を含む複数行の関数定義の再現を使って、新しい REPL と基本 REPL における Ctrl+D の処理を code.interact() と比較します。code.interact() が既存のコードを他の REPL と一貫して評価できれば完了です。リンクされている PR gh-139876 は、すでに作業が進行中であることを示しています。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- python
- 領域
- cli
- issue の種類
- バグ
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 活発さ
- 停滞
- 明瞭さ
- 明確に書かれている
- 初心者へのやさしさ
- 20/100