python / python/cpython

Use new REPL for the "code" module

未关闭
#119,512 4 条评论 4 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

stdlib topic-repl type-feature
主要语言
Python
星标
77.2k
派生
36k
PR 合并指标
PR 指标待抓取

描述

Feature or enhancement

Proposal:

When installing Django in a Python 3.13 virtual environment and using Django's shell command, the old REPL is used.

It would be great if the code module supported the new REPL. From @ambv's reply in https://github.com/python/cpython/issues/119433#issuecomment-2130060062 it looks like this will be considered in Python 3.14.


I would also like to know what projects should do in the meantime. For example, I found a way to modify Django's shell command in one's own project to use the new REPL, by using this within a try-except block:

from _pyrepl.simple_interact import run_multiline_interactive_console
run_multiline_interactive_console()

Is this an acceptable workaround before Python 3.14 is released? Or should this function not be relied on, seeing as it's in an undocumented module?

Has this already been discussed elsewhere?

No response given

Links to previous discussion of this feature:

https://github.com/python/cpython/pull/119433#pullrequestreview-2074755660

Linked PRs
  • gh-148261

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

首先审查 Python 代码模块和所引用的 _pyrepl.simple_interact workaround,然后阅读链接的 CPython 讨论和 PR gh-148261。完成标准是确定代码模块应如何使用新的 REPL,并明确该 workaround 在 Python 3.14 之前是否适用。

由索引模型根据 Issue 内容生成。

评估

技术栈
python
领域
cli
Issue 类型
功能
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。