python / python/cpython

Some ntpath/posixpath functions unusable on foreign OS

Aberta
#119,671 9 comentários 3 reações 0 responsáveis Ver no GitHub

Ninguém assumiu esta issue ainda.

docs
Linguagem predominante
Python
Estrelas
77.2k
Forks
35.9k
Métricas de merge de PRs
Métricas de PR pendentes

Descrição

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

Guia de contribuição

Abrir o guia de contribuição

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Direção de pesquisa

Comece com a introdução da documentação de os.path vinculada na issue e revise as listas de funções lexicais e dependentes do host. Verifique o PR vinculado gh-119772 antes de fazer alterações. Está concluído quando a documentação explicar claramente quais funções de ntpath e posixpath são seguras em um sistema operacional estrangeiro e quais dependem do sistema operacional host.

Escrita pelo modelo de indexação a partir do texto da issue.

Avaliação

Stack de tecnologia
python
Domínio
documentation
Tipo de issue
Documentação
Dificuldade
2/5
Tempo estimado
1-3 horas
Status de atividade
Estagnada
Clareza
Claramente especificada
Facilidade para iniciantes
20/100

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.