Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit dc2081f

Browse files
author
Victor Stinner
committed
Issue #9738: document encodings of unicode functions
1 parent 555a24f commit dc2081f

2 files changed

Lines changed: 9 additions & 6 deletions

File tree

Doc/c-api/unicode.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1063,7 +1063,8 @@ They all return *NULL* or ``-1`` if an exception occurs.
10631063
.. c:function:: int PyUnicode_CompareWithASCIIString(PyObject *uni, char *string)
10641064
10651065
Compare a unicode object, *uni*, with *string* and return -1, 0, 1 for less
1066-
than, equal, and greater than, respectively.
1066+
than, equal, and greater than, respectively. *string* is an ASCII-encoded
1067+
string (it is interpreted as ISO-8859-1).
10671068
10681069
10691070
.. c:function:: int PyUnicode_RichCompare(PyObject *left, PyObject *right, int op)

Include/unicodeobject.h

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -443,14 +443,14 @@ PyAPI_FUNC(PyObject*) PyUnicode_FromUnicode(
443443

444444
/* Similar to PyUnicode_FromUnicode(), but u points to UTF-8 encoded bytes */
445445
PyAPI_FUNC(PyObject*) PyUnicode_FromStringAndSize(
446-
const char *u, /* char buffer */
447-
Py_ssize_t size /* size of buffer */
446+
const char *u /* UTF-8 encoded string */
447+
Py_ssize_t size /* size of buffer */
448448
);
449449

450450
/* Similar to PyUnicode_FromUnicode(), but u points to null-terminated
451451
UTF-8 encoded bytes */
452452
PyAPI_FUNC(PyObject*) PyUnicode_FromString(
453-
const char *u /* string */
453+
const char *u /* UTF-8 encoded string */
454454
);
455455

456456
/* Return a read-only pointer to the Unicode object's internal
@@ -551,7 +551,9 @@ PyAPI_FUNC(PyObject *) _PyUnicode_FormatAdvanced(PyObject *obj,
551551

552552
PyAPI_FUNC(void) PyUnicode_InternInPlace(PyObject **);
553553
PyAPI_FUNC(void) PyUnicode_InternImmortal(PyObject **);
554-
PyAPI_FUNC(PyObject *) PyUnicode_InternFromString(const char *);
554+
PyAPI_FUNC(PyObject *) PyUnicode_InternFromString(
555+
const char *u /* UTF-8 encoded string */
556+
);
555557
#ifndef Py_LIMITED_API
556558
PyAPI_FUNC(void) _Py_ReleaseInternedUnicodeStrings(void);
557559
#endif
@@ -1455,7 +1457,7 @@ PyAPI_FUNC(int) PyUnicode_Compare(
14551457

14561458
PyAPI_FUNC(int) PyUnicode_CompareWithASCIIString(
14571459
PyObject *left,
1458-
const char *right
1460+
const char *right /* ASCII-encoded string */
14591461
);
14601462

14611463
/* Rich compare two strings and return one of the following:

0 commit comments

Comments
 (0)