summaryrefslogtreecommitdiffstats
path: root/Doc/c-api/unicode.rst
diff options
context:
space:
mode:
authorMartin Panter <vadmium+py@gmail.com>2016-04-15 00:56:21 (GMT)
committerMartin Panter <vadmium+py@gmail.com>2016-04-15 00:56:21 (GMT)
commit20d325574eaa4f2a88036eac81e8d3cf9135372f (patch)
treea304da2a75e65a5b306760550c2e003d1b193e61 /Doc/c-api/unicode.rst
parent6245cb3c015a5b9febef4d6ef30d3acfc762a79d (diff)
downloadcpython-20d325574eaa4f2a88036eac81e8d3cf9135372f.zip
cpython-20d325574eaa4f2a88036eac81e8d3cf9135372f.tar.gz
cpython-20d325574eaa4f2a88036eac81e8d3cf9135372f.tar.bz2
Issue #15984: Correct PyUnicode_FromObject() and _FromEncodedObject() docs
Diffstat (limited to 'Doc/c-api/unicode.rst')
-rw-r--r--Doc/c-api/unicode.rst12
1 files changed, 7 insertions, 5 deletions
diff --git a/Doc/c-api/unicode.rst b/Doc/c-api/unicode.rst
index 0c9ea8f..1ed8140 100644
--- a/Doc/c-api/unicode.rst
+++ b/Doc/c-api/unicode.rst
@@ -556,14 +556,13 @@ APIs:
.. c:function:: PyObject* PyUnicode_FromEncodedObject(PyObject *obj, \
const char *encoding, const char *errors)
- Coerce an encoded object *obj* to a Unicode object and return a reference with
- incremented refcount.
+ Decode an encoded object *obj* to a Unicode object.
:class:`bytes`, :class:`bytearray` and other
:term:`bytes-like objects <bytes-like object>`
are decoded according to the given *encoding* and using the error handling
defined by *errors*. Both can be *NULL* to have the interface use the default
- values (see the next section for details).
+ values (see :ref:`builtincodecs` for details).
All other objects, including Unicode objects, cause a :exc:`TypeError` to be
set.
@@ -745,8 +744,11 @@ Extension modules can continue using them, as they will not be removed in Python
.. c:function:: PyObject* PyUnicode_FromObject(PyObject *obj)
- Shortcut for ``PyUnicode_FromEncodedObject(obj, NULL, "strict")`` which is used
- throughout the interpreter whenever coercion to Unicode is needed.
+ Copy an instance of a Unicode subtype to a new true Unicode object if
+ necessary. If *obj* is already a true Unicode object (not a subtype),
+ return the reference with incremented refcount.
+
+ Objects other than Unicode or its subtypes will cause a :exc:`TypeError`.
Locale Encoding