Recognize platform.system() as well as sys.platform
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
Note: if you are reporting a wrong signature of a function or a class in
the standard library, then the typeshed tracker is better suited
for this report: https://github.com/python/typeshed/issues
Please provide more information to help us understand the issue:
- Are you reporting a bug, or opening a feature request? feature request
- Please insert below the code you are checking with mypy,
or a mock-up repro if the source is private. We would appreciate
if you try to simplify your case to a minimal repro.
if platform.system() != "Windows": # sys.platform != "win32":
try:
# os.confstr("CS_GNU_LIBC_VERSION") returns a string like "glibc 2.17".
version_string = os.confstr("CS_GNU_LIBC_VERSION")
assert version_string is not None
_, version = version_string.split()
except (AssertionError, OSError, ValueError):
# os.confstr() or CS_GNU_LIBC_VERSION not available (or a bad value)...
return None
return version
return None
- What is the actual behavior/output? "error: Module has no attribute "confstr""
- What is the behavior/output you expect? No error when run under Windows
- What are the versions of mypy and Python you are using? mypy 0.750, Python 3.7.4
Basically it would be nice to get to use platform.system() instead of having to use sys.platform to make mypy happy with code that is conditional on the platform.
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
Comienza con el repro de Python proporcionado y compara cómo maneja mypy platform.system() frente a sys.platform en código condicional. Identifica el punto de entrada del análisis específico de la plataforma y verifica el cambio comprobando que os.confstr no se notifica como ausente en la rama de Windows; el payload no indica ningún archivo fuente ni prueba.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- python
- Área
- devtools
- Tipo de issue
- Nueva funcionalidad
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 38/100