]> granicus.if.org Git - python/commitdiff
Issue #27182: Document os.PathLike.
authorBrett Cannon <brett@python.org>
Thu, 9 Jun 2016 22:58:06 +0000 (15:58 -0700)
committerBrett Cannon <brett@python.org>
Thu, 9 Jun 2016 22:58:06 +0000 (15:58 -0700)
Part of PEP 519.

Doc/library/functions.rst
Doc/library/os.rst

index 6f7ba1fe8a3ff3e79b3a4096095508b57d9b4fcb..5757ca4bb7920e2eb84c5eda7687b7e0e2c41b5b 100644 (file)
@@ -1077,6 +1077,9 @@ are always available.  They are listed here in alphabetical order.
    .. 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
index 3dca86e47353e1d72c306405fae0874fba3c0bc1..4070bf5fc3c0f5429a95a3d3f8fe0d7898b6b839 100644 (file)
@@ -175,6 +175,9 @@ process and user.
 
    .. versionadded:: 3.2
 
+   .. versionchanged:: 3.6
+      Support added to accept objects implementing :class:`os.PathLike`.
+
 
 .. function:: fsdecode(filename)
 
@@ -185,6 +188,9 @@ process and user.
 
    .. versionadded:: 3.2
 
+   .. versionchanged:: 3.6
+      Support added to accept objects implementing :class:`os.PathLike`.
+
 
 .. function:: fspath(path)
 
@@ -195,6 +201,21 @@ process and user.
    (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)