mypy crashes if collections import is removed from typing.pyi
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- Python
- Estrellas
- 20.6k
- Forks
- 3.3k
- Métricas de merge de PR
- Métricas de PR pendientes
Descripción
Bug Report
Noticed during python/typeshed#11238: When removing the (now unnecessary) collections import from stdlib/typing.pyi, mypy 1.8.0 will crash with the following traceback:
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "mypy/semanal.py", line 6539, in accept
File "mypy/nodes.py", line 1310, in accept
File "mypy/semanal.py", line 2889, in visit_assignment_stmt
File "mypy/semanal.py", line 3393, in process_type_annotation
File "mypy/semanal.py", line 6690, in anal_type
File "mypy/types.py", line 955, in accept
File "mypy/typeanal.py", line 259, in visit_unbound_type
File "mypy/typeanal.py", line 399, in visit_unbound_type_nonoptional
File "mypy/typeanal.py", line 6[24](https://github.com/python/typeshed/actions/runs/7411345628/job/20165674610?pr=11238#step:5:25), in try_analyze_special_unbound_type
File "mypy/typeanal.py", line 1470, in analyze_literal_type
File "mypy/typeanal.py", line 1484, in analyze_literal_param
File "mypy/typeanal.py", line 1738, in named_type
File "mypy/typeanal.py", line [25](https://github.com/python/typeshed/actions/runs/7411345628/job/20165674610?pr=11238#step:5:26)6, in lookup_fully_qualified
File "mypy/semanal.py", line 5852, in lookup_fully_qualified
AssertionError: builtins.str
To Reproduce
Check out typeshed, install mypy, remove the collections import from typing.pyi and run ./tests/typecheck_typeshed.py, which will call mypy and include the traceback.
Your Environment
Python 3.11.6, mypy 1.8.0
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Línea de trabajo
Reproduce el fallo eliminando el collections import de typeshed's stdlib/typing.pyi y ejecuta después ./tests/typecheck_typeshed.py. Empieza por las rutas del traceback en mypy/typeanal.py y mypy/semanal.py, especialmente analyze_literal_type y lookup_fully_qualified. Se considera terminado cuando la comprobación de typeshed finaliza sin el AssertionError para builtins.str.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- python
- Área
- tooling
- 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