summaryrefslogtreecommitdiff
path: root/Doc/c-api/bytes.rst
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2016-07-12 09:14:15 +0300
committerSerhiy Storchaka <storchaka@gmail.com>2016-07-12 09:14:15 +0300
commitcf44682405b5be84ab486598adf6ab113ca50bee (patch)
treeb4e5a76813ec0d48c2453fada178167938d5ffde /Doc/c-api/bytes.rst
parentd93a89ad6a774ac637ce1676f82cb0c07ff1cd1d (diff)
downloadcpython-cf44682405b5be84ab486598adf6ab113ca50bee.tar.gz
Issue #27481: Docummented that ValueError is now raised instead of TypeError
in case of embedded null characters/bytes. Patch by Xiang Zhang.
Diffstat (limited to 'Doc/c-api/bytes.rst')
-rw-r--r--Doc/c-api/bytes.rst6
1 files changed, 5 insertions, 1 deletions
diff --git a/Doc/c-api/bytes.rst b/Doc/c-api/bytes.rst
index 23b712881a..dcd7088629 100644
--- a/Doc/c-api/bytes.rst
+++ b/Doc/c-api/bytes.rst
@@ -158,7 +158,7 @@ called with a non-bytes parameter.
If *length* is *NULL*, the bytes object
may not contain embedded null bytes;
- if it does, the function returns ``-1`` and a :exc:`TypeError` is raised.
+ if it does, the function returns ``-1`` and a :exc:`ValueError` is raised.
The buffer refers to an internal buffer of *obj*, which includes an
additional null byte at the end (not counted in *length*). The data
@@ -167,6 +167,10 @@ called with a non-bytes parameter.
*obj* is not a bytes object at all, :c:func:`PyBytes_AsStringAndSize`
returns ``-1`` and raises :exc:`TypeError`.
+ .. versionchanged:: 3.5
+ Previously, :exc:`TypeError` was raised when embedded null bytes were
+ encountered in the bytes object.
+
.. c:function:: void PyBytes_Concat(PyObject **bytes, PyObject *newpart)