summaryrefslogtreecommitdiff
path: root/Doc
diff options
context:
space:
mode:
Diffstat (limited to 'Doc')
-rw-r--r--Doc/c-api/sys.rst5
-rw-r--r--Doc/library/os.rst14
2 files changed, 11 insertions, 8 deletions
diff --git a/Doc/c-api/sys.rst b/Doc/c-api/sys.rst
index f3cde8c573..035cdc1682 100644
--- a/Doc/c-api/sys.rst
+++ b/Doc/c-api/sys.rst
@@ -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
diff --git a/Doc/library/os.rst b/Doc/library/os.rst
index 465b218f3a..0346cc22a0 100644
--- a/Doc/library/os.rst
+++ b/Doc/library/os.rst
@@ -179,7 +179,8 @@ process and user.
.. versionadded:: 3.2
.. versionchanged:: 3.6
- Support added to accept objects implementing :class:`os.PathLike`.
+ Support added to accept objects implementing the :class:`os.PathLike`
+ interface.
.. function:: fsdecode(filename)
@@ -192,17 +193,18 @@ process and user.
.. versionadded:: 3.2
.. versionchanged:: 3.6
- Support added to accept objects implementing :class:`os.PathLike`.
+ Support added to accept objects implementing the :class:`os.PathLike`
+ interface.
.. function:: fspath(path)
Return the file system representation of the path.
- If :class:`str` or :class:`bytes` is passed in, it is returned unchanged;
- otherwise, the result of calling ``type(path).__fspath__`` is returned
- (which is represented by :class:`os.PathLike`). All other types raise a
- :exc:`TypeError`.
+ If :class:`str` or :class:`bytes` is passed in, it is returned unchanged.
+ Otherwise :meth:`~os.PathLike.__fspath__` is called and its value is
+ returned as long as it is a :class:`str` or :class:`bytes` object.
+ In all other cases, :exc:`TypeError` is raised.
.. versionadded:: 3.6