summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorBrett Cannon <brett@python.org>2016-09-07 02:36:01 (GMT)
committerBrett Cannon <brett@python.org>2016-09-07 02:36:01 (GMT)
commita571120410bf7a92ca612068cf1a754d5dca614e (patch)
tree875c341f44dfbf0cc486c40170af17f300eead44 /Doc
parenta439191efa9fee12ea3c17b23b0d3f748ff76997 (diff)
downloadcpython-a571120410bf7a92ca612068cf1a754d5dca614e.zip
cpython-a571120410bf7a92ca612068cf1a754d5dca614e.tar.gz
cpython-a571120410bf7a92ca612068cf1a754d5dca614e.tar.bz2
Issue #27182: Add support for path-like objects to PyUnicode_FSDecoder().
Diffstat (limited to 'Doc')
-rw-r--r--Doc/c-api/unicode.rst12
-rw-r--r--Doc/whatsnew/3.6.rst18
2 files changed, 19 insertions, 11 deletions
diff --git a/Doc/c-api/unicode.rst b/Doc/c-api/unicode.rst
index 019453f..55ef575 100644
--- a/Doc/c-api/unicode.rst
+++ b/Doc/c-api/unicode.rst
@@ -826,13 +826,17 @@ used, passing :c:func:`PyUnicode_FSDecoder` as the conversion function:
.. c:function:: int PyUnicode_FSDecoder(PyObject* obj, void* result)
- ParseTuple converter: decode :class:`bytes` objects to :class:`str` using
- :c:func:`PyUnicode_DecodeFSDefaultAndSize`; :class:`str` objects are output
- as-is. *result* must be a :c:type:`PyUnicodeObject*` which must be released
- when it is no longer used.
+ ParseTuple converter: decode :class:`bytes` objects -- obtained either
+ directly or indirectly through the :class:`os.PathLike` interface -- to
+ :class:`str` using :c:func:`PyUnicode_DecodeFSDefaultAndSize`; :class:`str`
+ objects are output as-is. *result* must be a :c:type:`PyUnicodeObject*` which
+ must be released when it is no longer used.
.. versionadded:: 3.2
+ .. versionchanged:: 3.6
+ Accepts a :term:`path-like object`.
+
.. c:function:: PyObject* PyUnicode_DecodeFSDefaultAndSize(const char *s, Py_ssize_t size)
diff --git a/Doc/whatsnew/3.6.rst b/Doc/whatsnew/3.6.rst
index 69f8f39..0517ef8 100644
--- a/Doc/whatsnew/3.6.rst
+++ b/Doc/whatsnew/3.6.rst
@@ -160,14 +160,18 @@ object.
The built-in :func:`open` function has been updated to accept
:class:`os.PathLike` objects as have all relevant functions in the
-:mod:`os` and :mod:`os.path` modules. The :class:`os.DirEntry` class
+:mod:`os` and :mod:`os.path` modules. :c:func:`PyUnicode_FSConverter`
+and :c:func:`PyUnicode_FSConverter` have been changed to accept
+path-like objects. The :class:`os.DirEntry` class
and relevant classes in :mod:`pathlib` have also been updated to
-implement :class:`os.PathLike`. The hope is that updating the
-fundamental functions for operating on file system paths will lead
-to third-party code to implicitly support all
-:term:`path-like objects <path-like object>` without any code changes
-or at least very minimal ones (e.g. calling :func:`os.fspath` at the
-beginning of code before operating on a path-like object).
+implement :class:`os.PathLike`.
+
+The hope in is that updating the fundamental functions for operating
+on file system paths will lead to third-party code to implicitly
+support all :term:`path-like objects <path-like object>` without any
+code changes or at least very minimal ones (e.g. calling
+:func:`os.fspath` at the beginning of code before operating on a
+path-like object).
Here are some examples of how the new interface allows for
:class:`pathlib.Path` to be used more easily and transparently with