Skip to content

Commit 11b9f43

Browse files
committed
Use uint32_t for the format
1 parent fa0ff6d commit 11b9f43

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

Include/unicodeobject.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -261,23 +261,23 @@ PyAPI_FUNC(PyObject *) PyUnicode_InternFromString(
261261
// The export must be released by PyUnicode_ReleaseExport().
262262
PyAPI_FUNC(const void*) PyUnicode_Export(
263263
PyObject *unicode,
264-
unsigned int supported_formats,
264+
uint32_t supported_formats,
265265
Py_ssize_t *size,
266-
unsigned int *format);
266+
uint32_t *format);
267267

268268
// Release an export created by PyUnicode_Export().
269269
PyAPI_FUNC(void) PyUnicode_ReleaseExport(
270270
PyObject *unicode,
271271
const void* data,
272-
unsigned int format);
272+
uint32_t format);
273273

274274
// Create a string object from a string in the format 'format'.
275275
// - Return a reference to a new string object on success.
276276
// - Set an exception and return NULL on error.
277277
PyAPI_FUNC(PyObject*) PyUnicode_Import(
278278
const void *data,
279279
Py_ssize_t size,
280-
unsigned int format);
280+
uint32_t format);
281281

282282
/* --- wchar_t support for platforms which support it --------------------- */
283283

Modules/_testlimitedcapi/unicode.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1849,13 +1849,13 @@ unicode_export(PyObject *self, PyObject *args)
18491849
}
18501850

18511851
Py_ssize_t size;
1852-
unsigned int format;
1852+
uint32_t format;
18531853
const void *data = PyUnicode_Export(obj, supported_formats, &size, &format);
18541854
if (data == NULL) {
18551855
return NULL;
18561856
}
18571857

1858-
PyObject *res = Py_BuildValue("y#i", data, size, format);
1858+
PyObject *res = Py_BuildValue("y#I", data, size, (unsigned int)format);
18591859
PyUnicode_ReleaseExport(obj, data, format);
18601860
return res;
18611861
}
@@ -1868,7 +1868,7 @@ unicode_import(PyObject *self, PyObject *args)
18681868
const void *data;
18691869
Py_ssize_t size;
18701870
unsigned int format;
1871-
if (!PyArg_ParseTuple(args, "y#i", &data, &size, &format)) {
1871+
if (!PyArg_ParseTuple(args, "y#I", &data, &size, &format)) {
18721872
return NULL;
18731873
}
18741874
return PyUnicode_Import(data, size, format);

Objects/unicodeobject.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2098,8 +2098,8 @@ _PyUnicode_FromUCS4(const Py_UCS4 *u, Py_ssize_t size)
20982098
}
20992099

21002100
const void*
2101-
PyUnicode_Export(PyObject *unicode, unsigned int supported_formats,
2102-
Py_ssize_t *size, unsigned int *format)
2101+
PyUnicode_Export(PyObject *unicode, uint32_t supported_formats,
2102+
Py_ssize_t *size, uint32_t *format)
21032103
{
21042104
if (!PyUnicode_Check(unicode)) {
21052105
PyErr_Format(PyExc_TypeError, "must be str, not %T", unicode);
@@ -2173,7 +2173,7 @@ PyUnicode_Export(PyObject *unicode, unsigned int supported_formats,
21732173

21742174
void
21752175
PyUnicode_ReleaseExport(PyObject *unicode, const void* data,
2176-
unsigned int format)
2176+
uint32_t format)
21772177
{
21782178
switch (format)
21792179
{
@@ -2198,7 +2198,7 @@ PyUnicode_ReleaseExport(PyObject *unicode, const void* data,
21982198

21992199
PyObject*
22002200
PyUnicode_Import(const void *data, Py_ssize_t size,
2201-
unsigned int format)
2201+
uint32_t format)
22022202
{
22032203
if (size < 0) {
22042204
PyErr_SetString(PyExc_ValueError, "Negative size");

0 commit comments

Comments
 (0)