summaryrefslogtreecommitdiffstats
path: root/Doc/c-api/object.rst
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2008-08-26 16:46:47 (GMT)
committerBenjamin Peterson <benjamin@python.org>2008-08-26 16:46:47 (GMT)
commitc15a07333e712e682036d9ecb7230d25ccb1a85f (patch)
tree52eee04b10bc95047d25c9dd6b82ec9e48efeb97 /Doc/c-api/object.rst
parenta786b026c9992cee195b7a550bab2c70c50f874f (diff)
downloadcpython-c15a07333e712e682036d9ecb7230d25ccb1a85f.zip
cpython-c15a07333e712e682036d9ecb7230d25ccb1a85f.tar.gz
cpython-c15a07333e712e682036d9ecb7230d25ccb1a85f.tar.bz2
make bytes(o) respect __bytes__ #2415
This adds two new C-API functions: PyObject_Bytes and PyBytes_FromObject. Reviewer: Barry
Diffstat (limited to 'Doc/c-api/object.rst')
-rw-r--r--Doc/c-api/object.rst8
1 files changed, 8 insertions, 0 deletions
diff --git a/Doc/c-api/object.rst b/Doc/c-api/object.rst
index 193ab95..7b9682c 100644
--- a/Doc/c-api/object.rst
+++ b/Doc/c-api/object.rst
@@ -139,6 +139,14 @@ Object Protocol
Python expression ``str(o)``. Called by the :func:`str` built-in function
and, therefore, by the :func:`print` function.
+.. cfunction:: PyObject* PyObject_Bytes(PyObject *o)
+
+ .. index:: builtin: bytes
+
+ Compute a bytes representation of object *o*. *NULL* is returned on failure
+ and a bytes object on success. This is equivalent to the Python expression
+ ``bytes(o)``.
+
.. cfunction:: int PyObject_IsInstance(PyObject *inst, PyObject *cls)