Skip to content

Commit 076985d

Browse files
committed
Rename PyUnicode_FreeExport() to PyUnicode_ReleaseExport()
1 parent 4d77192 commit 076985d

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

Include/unicodeobject.h

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -254,21 +254,24 @@ PyAPI_FUNC(PyObject *) PyUnicode_InternFromString(
254254
#define PyUnicode_FORMAT_UCS4 0x08
255255
#define PyUnicode_FORMAT_UTF8 0x10
256256

257-
// Get the content of a string in its native format.
258-
// - Return the content, set '*size' and '*native_format' on success.
257+
// Get the content of a string in the requested format:
258+
// - Return the content, set '*size' and '*format' on success.
259259
// - Set an exception and return NULL on error.
260+
//
261+
// The export must be released by PyUnicode_ReleaseExport().
260262
PyAPI_FUNC(const void*) PyUnicode_Export(
261263
PyObject *unicode,
262264
unsigned int supported_formats,
263265
Py_ssize_t *size,
264266
unsigned int *format);
265267

266-
PyAPI_FUNC(void) PyUnicode_FreeExport(
268+
// Release an export created by PyUnicode_Export().
269+
PyAPI_FUNC(void) PyUnicode_ReleaseExport(
267270
PyObject *unicode,
268271
const void* data,
269272
unsigned int format);
270273

271-
// Create a string object from a native format string.
274+
// Create a string object from a string in the format 'format'.
272275
// - Return a reference to a new string object on success.
273276
// - Set an exception and return NULL on error.
274277
PyAPI_FUNC(PyObject*) PyUnicode_Import(

Modules/_testlimitedcapi/unicode.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1856,7 +1856,7 @@ unicode_export(PyObject *self, PyObject *args)
18561856
}
18571857

18581858
PyObject *res = Py_BuildValue("y#i", data, size, format);
1859-
PyUnicode_FreeExport(obj, data, format);
1859+
PyUnicode_ReleaseExport(obj, data, format);
18601860
return res;
18611861
}
18621862

Objects/unicodeobject.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2170,7 +2170,8 @@ PyUnicode_Export(PyObject *unicode, unsigned int supported_formats,
21702170
}
21712171

21722172
void
2173-
PyUnicode_FreeExport(PyObject *unicode, const void* data, unsigned int format)
2173+
PyUnicode_ReleaseExport(PyObject *unicode, const void* data,
2174+
unsigned int format)
21742175
{
21752176
switch (format)
21762177
{

0 commit comments

Comments
 (0)