print _pyrepl.readline._wrapper.reader will raise error'UnixConsole' object has no attribute 'posxy'
未关闭
还没有人认领这个 Issue。
pending
stdlib
topic-repl
type-bug
- 主要语言
- Python
- 星标
- 77.2k
- 派生
- 36k
- PR 合并指标
- PR 指标待抓取
描述
Bug report
Bug description:
print('Before importing _pyrepl.readline:')
import sys
import os
print('PYTHON_HISTORY:', os.environ.get('PYTHON_HISTORY'))
print('\\nImporting _pyrepl.readline...')
import _pyrepl.readline
print('After importing:')
print('History length:', _pyrepl.readline.get_current_history_length())
print('Wrapper object:', _pyrepl.readline._wrapper)
print('Wrapper reader:', _pyrepl.readline._wrapper.reader)
./python.exe test.py
Before importing _pyrepl.readline:
PYTHON_HISTORY: None
\nImporting _pyrepl.readline...
After importing:
History length: 0
Wrapper object: _ReadlineWrapper(f_in=3, f_out=4, saved_history_length=-1, startup_hook=None)
Wrapper reader: Traceback (most recent call last):
File "/Users/yihong/test.py", line 12, in <module>
print('Wrapper reader:', _pyrepl.readline._wrapper.reader)
~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/python@3.13/3.13.2/Frameworks/Python.framework/Versions/3.13/lib/python3.13/reprlib.py", line 21, in wrapper
result = user_function(self)
File "<string>", line 41, in __repr__
File "/opt/homebrew/Cellar/python@3.13/3.13.2/Frameworks/Python.framework/Versions/3.13/lib/python3.13/reprlib.py", line 21, in wrapper
result = user_function(self)
File "<string>", line 9, in __repr__
AttributeError: 'UnixConsole' object has no attribute 'posxy'
this exists from 3.13 to 3.15
CPython versions tested on:
CPython main branch
Operating systems tested on:
macOS
Linked PRs
- gh-139351
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
使用提供的脚本重现 macOS 失败,从 _pyrepl.readline 入口点及其 _wrapper.reader 表示开始。检查 UnixConsole 的表示路径,并验证打印 reader 时不再因缺少 posxy 而引发 AttributeError。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- python
- 领域
- cli
- Issue 类型
- 缺陷
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 25/100