TransformVisitor (and StrConv) are slightly out-of-sync with node definitions

Abierto
#2,109 7 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

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

Línea de trabajo

Review TransformVisitor in mypy.treetransform and StrConv in mypy.strconv against the node definitions in mypy.nodes; start with the listed visitor methods and attributes. Check related visitors for similar mismatches, then add coverage that detects missing copied attributes and verify the listed cases are handled.

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

Descripción

refactoring

I recently noticed that mypy.treetransform.TransformVisitor seems to be slightly out-of-sync with the nodes within mypy.nodes.

For example...

  • visit_func_def isn't copying over the is_generator, is_coroutine, and is_awaitable_coroutine attributes
  • visit_var isn't copying over the is_suppressed_import attribute
  • visit_with_statement isn't copying over is_async
  • visit_class_def isn't copying over has_incompatible_baseclass

Currently, it doesn't seem like these omissions are too harmful since the only place we use TransformVisitor is within TypeTransformVisitor (which only expands types). However, I could see this might lead to subtle bugs in the future, so it's probably worth fixing this now and perhaps coming up with some sort of test that will automatically catch these sorts of discrepancies in the future.

mypy.strconv.StrConv also seems to have similar issues, though it's probably even less of a priority. I haven't really checked the other visitors, so I don't know if they're similarly desynched.

(I'm filing this issue to make sure I don't forget about it).

Lenguaje dominante
Python
Estrellas
20.6k
Forks
3.3k
Merge medio
1 d 18 h
PR fusionados (30 d)
54

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.

Más de python/mypy

Todos los issues de python/mypy

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.