mirror of
https://github.com/python/cpython.git
synced 2025-07-24 19:54:21 +00:00
Issue #27186: Update os.fspath()/PyOS_FSPath() to check the return
type of __fspath__(). As part of this change, also make sure that the pure Python implementation of os.fspath() is tested.
This commit is contained in:
parent
19b2a53a82
commit
c78ca1e044
7 changed files with 101 additions and 71 deletions
|
@ -10,8 +10,9 @@ Operating System Utilities
|
|||
Return the file system representation for *path*. If the object is a
|
||||
:class:`str` or :class:`bytes` object, then its reference count is
|
||||
incremented. If the object implements the :class:`os.PathLike` interface,
|
||||
then ``type(path).__fspath__()`` is returned. Otherwise :exc:`TypeError` is
|
||||
raised and ``NULL`` is returned.
|
||||
then :meth:`~os.PathLike.__fspath__` is returned as long as it is a
|
||||
:class:`str` or :class:`bytes` object. Otherwise :exc:`TypeError` is raised
|
||||
and ``NULL`` is returned.
|
||||
|
||||
.. versionadded:: 3.6
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue