python / python/cpython

Some ntpath/posixpath functions unusable on foreign OS

Abierto
#119,671 9 comentarios 3 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

docs
Lenguaje dominante
Python
Estrellas
77.2k
Forks
35.9k
Métricas de merge de PR
Métricas de PR pendientes

Descripción

The os.path docs intro includes:

Note: Since different operating systems have different path name conventions, there are several versions of this module in the standard library. The os.path module is always the path module suitable for the operating system Python is running on, and therefore usable for local paths. However, you can also import and use the individual modules if you want to manipulate a path that is always in one of the different formats. They all have the same interface:

  • posixpath for UNIX-style paths
  • ntpath for Windows paths

But we don't explain that some of the functions in ntpath and posixpath aren't suitable for usage on a "foreign" OS, e.g. that using ntpath.realpath() from POSIX is a bad idea.

These functions are safe because they do purely lexical work:

  • basename
  • commonpath
  • commonprefix
  • dirname
  • isabs
  • join
  • normcase
  • normpath
  • split
  • splitdrive
  • splitroot
  • splitext

These functions are probably unsafe because they rely on details of the host OS (e.g. via the os module):

  • abspath
  • exists
  • lexists
  • expanduser
  • expandvars
  • getatime
  • getmtime
  • getctime
  • getsize
  • isfile
  • isdir
  • isjunction
  • islink
  • ismount
  • isdevdrive
  • realpath
  • relpath
  • samefile
  • sameopenfile
  • samestat
  • supports_unicode_filenames
Linked PRs
  • gh-119772

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

Comienza con la introducción de la documentación de os.path enlazada en el issue y revisa las listas de funciones léxicas y dependientes del host. Revisa el PR enlazado gh-119772 antes de hacer cambios. Se considera terminado cuando la documentación explique claramente qué funciones de ntpath y posixpath son seguras en un sistema operativo extranjero y cuáles dependen del sistema operativo host.

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

Evaluación

Stack tecnológico
python
Área
documentation
Tipo de issue
Documentación
Dificultad
2/5
Tiempo estimado
1-3 horas
Estado de actividad
Estancado
Claridad
Bien especificado
Aptitud para principiantes
20/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.