[docs] [issue31871] Support for file descriptor params in os.path

Serhiy Storchaka report at bugs.python.org
Sat Oct 28 05:49:54 EDT 2017


Serhiy Storchaka <storchaka+cpython at gmail.com> added the comment:

Éric, see https://docs.python.org/3/library/os.html#files-and-directories.

Yes, now some os.path functions can accept a file descriptor as a path. I don't think this is intentional. And this may not work on all platforms.

>>> os.path.isdir(1)
False
>>> os.path.islink(1)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/serhiy/py/cpython/Lib/posixpath.py", line 169, in islink
    st = os.lstat(path)
TypeError: lstat: path should be string, bytes or os.PathLike, not int

----------
nosy: +serhiy.storchaka

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue31871>
_______________________________________


More information about the docs mailing list