[Python-checkins] cpython: Issue #27182: Document os.PathLike.
brett.cannon
python-checkins at python.org
Thu Jun 9 18:58:12 EDT 2016
https://hg.python.org/cpython/rev/6239673d5e1d
changeset: 101829:6239673d5e1d
user: Brett Cannon <brett at python.org>
date: Thu Jun 09 15:58:06 2016 -0700
summary:
Issue #27182: Document os.PathLike.
Part of PEP 519.
files:
Doc/library/functions.rst | 3 +++
Doc/library/os.rst | 21 +++++++++++++++++++++
2 files changed, 24 insertions(+), 0 deletions(-)
diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst
--- a/Doc/library/functions.rst
+++ b/Doc/library/functions.rst
@@ -1077,6 +1077,9 @@
.. versionchanged:: 3.5
The ``'namereplace'`` error handler was added.
+ .. versionchanged:: 3.6
+ Support added to accept objects implementing :class:`os.PathLike`.
+
.. function:: ord(c)
Given a string representing one Unicode character, return an integer
diff --git a/Doc/library/os.rst b/Doc/library/os.rst
--- a/Doc/library/os.rst
+++ b/Doc/library/os.rst
@@ -175,6 +175,9 @@
.. versionadded:: 3.2
+ .. versionchanged:: 3.6
+ Support added to accept objects implementing :class:`os.PathLike`.
+
.. function:: fsdecode(filename)
@@ -185,6 +188,9 @@
.. versionadded:: 3.2
+ .. versionchanged:: 3.6
+ Support added to accept objects implementing :class:`os.PathLike`.
+
.. function:: fspath(path)
@@ -195,6 +201,21 @@
(which is represented by :class:`os.PathLike`). All other types raise a
:exc:`TypeError`.
+ .. versionadded:: 3.6
+
+
+.. class:: PathLike
+
+ An :term:`abstract base class` for objects representing a file system path,
+ e.g. :class:`pathlib.PurePath`.
+
+ .. abstractmethod:: __fspath__()
+
+ Return the file system path representation of the object.
+
+ The method should only return a :class:`str` or :class:`bytes` object,
+ with the preference being for :class:`str`.
+
.. function:: getenv(key, default=None)
--
Repository URL: https://hg.python.org/cpython
More information about the Python-checkins
mailing list