python / python/cpython

Python 3.14 REPL blanks links above terminal rows when pasting

Abierto
#135,055 5 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

3.14 3.15 stdlib topic-repl type-bug
Lenguaje dominante
Python
Estrellas
77.2k
Forks
35.9k
Métricas de merge de PR
Métricas de PR pendientes

Descripción

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:

  1. Resize your terminal so the height is approximately 20 rows
  2. Paste the below block of Python code.
  3. Scroll up in your terminal to see previous lines above the last 20 rows
  4. 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

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Línea de trabajo

Reproduzca el comportamiento de la REPL de Python 3.14 en una terminal de Linux redimensionada a unas 20 filas, utilizando el ejemplo pegado de este issue. Lea la sección “Blank lines” del issue #119517 para obtener contexto relacionado y, a continuación, verifique que las filas pegadas por encima de la ventana gráfica de la terminal sigan siendo visibles al desplazarse hacia atrás.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
python
Área
cli
Tipo de issue
Error
Dificultad
3/5
Tiempo estimado
1-2 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
45/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.