python / python/mypy

Spurious errors on the builtin open when running mypy on mypy

Abierto
#14,796 5 comentarios 2 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

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

Descripción

When running mypy following the procedure below, I encounter several errors for the overloaded open builtin of the form:

../python3.11/site-packages/mypy/typeshed/stdlib/builtins.pyi:1327: error: Argument 8 to "open" becomes "Optional[Any]" due to an unfollowed import  [no-any-unimported]

To reproduce:

  1. Set up a virtualenv with Python 3.11 and activate it.
  2. pip install mypy
  3. python-m mypy --strict --no-silence-site-packages --disallow-any-unimported -m mypy

Both --no-silence-site-packages and --disallow-any-unimported need to be present.

Version 1.0.0 of mypy is required. Older versions don't exhibit this error.

This is the simplest way we have found to reproduce this problem, but we first encountered it in one of our own projects.

The issue is being filed here because the mypy docs for reporting bugs says that problems with a specific library function should be reported here. We're not seeing this error with any other functions.

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

Reproduce el informe con Python 3.11, mypy 1.0.0 y el comando documentado usando --no-silence-site-packages y --disallow-any-unimported. Empieza inspeccionando typeshed/stdlib/builtins.pyi alrededor de la línea 1327 y el tratamiento del open incorporado; el trabajo estará terminado cuando el comando deje de informar de los errores espurios no-any-unimported.

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

Evaluación

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

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.