diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2016-07-12 06:14:15 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2016-07-12 06:14:15 (GMT) |
commit | 6f379f48862e4707e631e23997b19646ee1f2f72 (patch) | |
tree | 75dbc4854b37f15e8fe5f9dc9930f9c2a7698e75 /Doc/c-api/bytes.rst | |
parent | 204bf0b9aecd221c33f3e0909f261411783acf1b (diff) | |
download | cpython-6f379f48862e4707e631e23997b19646ee1f2f72.zip cpython-6f379f48862e4707e631e23997b19646ee1f2f72.tar.gz cpython-6f379f48862e4707e631e23997b19646ee1f2f72.tar.bz2 |
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.rst | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/Doc/c-api/bytes.rst b/Doc/c-api/bytes.rst index 23b7128..dcd7088 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) |