Python 3.14 REPL blanks links above terminal rows when pasting
還沒有人認領這個 Issue。
- 主要語言
- Python
- 星號
- 77.2k
- 分支
- 35.9k
- PR 合併指標
- PR 指標待擷取
描述
Bug report
Bug description:
In Python 3.14 beta 2, pasting code that has more lines than the height of my terminal window will result in the lines just above the terminal window being blank.
To reproduce:
- Resize your terminal so the height is approximately 20 rows
- Paste the below block of Python code.
- Scroll up in your terminal to see previous lines above the last 20 rows
- Note that all rows above the terminal screen are blank (no
class Point:line or__slots__line for example)
class Point:
__slots__ = ('x', 'y')
__match_args__ = ('x', 'y')
def __init__(self, x: float, y: float) -> None:
object.__setattr__(self, 'x', x)
object.__setattr__(self, 'y', y)
def __repr__(self):
cls = type(self).__name__
return f'{cls}(x={self.x!r}, y={self.y!r})'
def __eq__(self, other):
if not isinstance(other, Point):
return NotImplemented
return (self.x, self.y) == (other.x, other.y)
def __hash__(self):
return hash((self.x, self.y))
def __setattr__(self, name, value):
raise AttributeError(f"Can't set attribute {name!r}")
def __delattr__(self, name):
raise AttributeError(f"Can't delete attribute {name!r}")
def __getstate__(self):
return (self.x, self.y)
def __setstate__(self, state):
fields = ('x', 'y')
for field, value in zip(fields, state):
object.__setattr__(self, field, value)
This is essentially the same as the "Blank lines" section of issue #119517.
I assume this is being done for performance reasons, but this is going to make my life harder when teaching. I often use a large font when teaching, so it's not uncommon that I'll paste a block of code that is longer than the terminal height. Being able to scroll up and show my students what was pasted is an essential feature for me when teaching.
CPython versions tested on:
3.14
Operating systems tested on:
Linux
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
研究方向
使用此 issue 中貼上的範例,在調整為約 20 行的 Linux 終端機中重現 Python 3.14 REPL 的行為。閱讀 issue #119517 的「Blank lines」部分以了解相關背景,然後驗證終端機視窗上方的已貼上行在向上捲動時仍保持可見。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- python
- 領域
- cli
- Issue 類型
- 缺陷
- 難度
- 3/5
- 預估耗時
- 1-2 天
- 活躍度
- 停滯
- 描述清晰度
- 基本清楚
- 新手友好度
- 45/100