]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-111089: PyUnicode_AsUTF8() now raises on embedded NUL (#111091)
authorVictor Stinner <vstinner@python.org>
Fri, 20 Oct 2023 15:59:29 +0000 (17:59 +0200)
committerGitHub <noreply@github.com>
Fri, 20 Oct 2023 15:59:29 +0000 (17:59 +0200)
commitd731579bfb9a497cfb0076cb6b221058a20088fe
tree63eb8f9b8dfb7af9a5de6d4499ab375b80f208d4
parent59ea0f523e155ac1a471cd292b41a76241fccd36
gh-111089: PyUnicode_AsUTF8() now raises on embedded NUL (#111091)

* PyUnicode_AsUTF8() now raises an exception if the string contains
  embedded null characters.
* Update related C API tests (test_capi.test_unicode).
* type_new_set_doc() uses PyUnicode_AsUTF8AndSize() to silently
  truncate doc containing null bytes.

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Doc/c-api/unicode.rst
Doc/whatsnew/3.13.rst
Include/cpython/unicodeobject.h
Include/unicodeobject.h
Lib/test/test_capi/test_unicode.py
Misc/NEWS.d/next/C API/2023-10-20-01-42-43.gh-issue-111089.VIrd5q.rst [new file with mode: 0644]
Objects/typeobject.c
Objects/unicodeobject.c