Skip to content

Commit 193c18b

Browse files
committed
Rename to PyUnicode_AsUTF8NoNUL()
1 parent 844a399 commit 193c18b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+199
-199
lines changed

Doc/c-api/unicode.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1015,7 +1015,7 @@ These are the UTF-8 codec APIs:
10151015
.. versionchanged:: 3.13
10161016
Raise an exception if the string contains embedded null characters.
10171017
1018-
.. c:function:: const char* PyUnicode_AsUTF8Safe(PyObject *unicode)
1018+
.. c:function:: const char* PyUnicode_AsUTF8NoNUL(PyObject *unicode)
10191019
10201020
Similar to :c:func:`PyUnicode_AsUTF8`, but raise :exc:`ValueError` if the
10211021
string contains embedded null characters.

Doc/data/stable_abi.dat

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Doc/whatsnew/3.13.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1137,7 +1137,7 @@ New Features
11371137
* Add :c:func:`PyUnicode_AsUTF8` function to the limited C API.
11381138
(Contributed by Victor Stinner in :gh:`111089`.)
11391139

1140-
* Add :c:func:`PyUnicode_AsUTF8Safe` function: similar to
1140+
* Add :c:func:`PyUnicode_AsUTF8NoNUL` function: similar to
11411141
:c:func:`PyUnicode_AsUTF8`, but raise :exc:`ValueError` if the string
11421142
contains embedded null characters.
11431143
(Contributed by Victor Stinner in :gh:`111089`.)

Include/unicodeobject.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,7 @@ PyAPI_FUNC(const char *) PyUnicode_AsUTF8(PyObject *unicode);
455455

456456
// Similar to PyUnicode_AsUTF8(), but raise ValueError if the string contains
457457
// embedded null characters.
458-
PyAPI_FUNC(const char *) PyUnicode_AsUTF8Safe(PyObject *unicode);
458+
PyAPI_FUNC(const char *) PyUnicode_AsUTF8NoNUL(PyObject *unicode);
459459

460460
// Returns a pointer to the UTF-8 encoding of the
461461
// Unicode object unicode and the size of the encoded representation

Lib/test/test_capi/test_unicode.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -928,14 +928,14 @@ def test_asutf8(self):
928928

929929
@support.cpython_only
930930
@unittest.skipIf(_testcapi is None, 'need _testcapi module')
931-
def test_asutf8safe(self):
932-
"""Test PyUnicode_AsUTF8Safe()"""
933-
from _testcapi import unicode_asutf8safe
934-
self.check_asutf8(unicode_asutf8safe)
931+
def test_asutf8nonul(self):
932+
"""Test PyUnicode_AsUTF8NoNUL()"""
933+
from _testcapi import unicode_asutf8nonul
934+
self.check_asutf8(unicode_asutf8nonul)
935935

936936
# disallow embedded null characters
937-
self.assertRaises(ValueError, unicode_asutf8safe, 'abc\0', 0)
938-
self.assertRaises(ValueError, unicode_asutf8safe, 'abc\0def', 0)
937+
self.assertRaises(ValueError, unicode_asutf8nonul, 'abc\0', 0)
938+
self.assertRaises(ValueError, unicode_asutf8nonul, 'abc\0def', 0)
939939

940940
@support.cpython_only
941941
@unittest.skipIf(_testcapi is None, 'need _testcapi module')

Lib/test/test_stable_abi_ctypes.py

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
Add :c:func:`PyUnicode_AsUTF8Safe` function: similar to
1+
Add :c:func:`PyUnicode_AsUTF8NoNUL` function: similar to
22
:c:func:`PyUnicode_AsUTF8`, but raise :exc:`ValueError` if the string
33
contains embedded null characters. Patch by Victor Stinner.

Misc/stable_abi.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2480,7 +2480,7 @@
24802480
added = '3.13'
24812481
[function.PyUnicode_AsUTF8]
24822482
added = '3.13'
2483-
[function.PyUnicode_AsUTF8Safe]
2483+
[function.PyUnicode_AsUTF8NoNUL]
24842484
added = '3.13'
24852485
[function._Py_SetRefcnt]
24862486
added = '3.13'

Modules/_io/clinic/_iomodule.c.h

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Modules/_io/clinic/fileio.c.h

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Modules/_io/clinic/textio.c.h

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Modules/_io/clinic/winconsoleio.c.h

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Modules/_multiprocessing/clinic/multiprocessing.c.h

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Modules/_multiprocessing/clinic/semaphore.c.h

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Modules/_sqlite/clinic/connection.c.h

Lines changed: 13 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Modules/_sqlite/clinic/cursor.c.h

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Modules/_sqlite/clinic/module.c.h

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Modules/_sqlite/connection.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ isolation_level_converter(PyObject *str_or_none, const char **result)
7676
*result = NULL;
7777
}
7878
else if (PyUnicode_Check(str_or_none)) {
79-
const char *str = PyUnicode_AsUTF8Safe(str_or_none);
79+
const char *str = PyUnicode_AsUTF8NoNUL(str_or_none);
8080
if (str == NULL) {
8181
return 0;
8282
}

Modules/_testcapi/clinic/exceptions.c.h

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)