Difference in Ctrl+D Behavior Between REPL and `code.interact`
未關閉
還沒有人認領這個 Issue。
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 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
研究方向
首先,使用 issue 中帶有空行的多行函式定義重現,將新的 REPL 和基本 REPL 中對 Ctrl+D 的處理與 code.interact() 進行比較。完成的標準是 code.interact() 能夠與其他 REPL 一致地評估現有程式碼;連結的 PR gh-139876 表示相關工作已經在進行中。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- python
- 領域
- cli
- Issue 類型
- 缺陷
- 難度
- 2/5
- 預估耗時
- 1-3 小時
- 活躍度
- 停滯
- 描述清晰度
- 描述清楚
- 新手友好度
- 20/100