summaryrefslogtreecommitdiffstats
path: root/Doc/c-api
diff options
context:
space:
mode:
Diffstat (limited to 'Doc/c-api')
-rw-r--r--Doc/c-api/init.rst4
-rw-r--r--Doc/c-api/unicode.rst29
2 files changed, 21 insertions, 12 deletions
diff --git a/Doc/c-api/init.rst b/Doc/c-api/init.rst
index b2baab5..d79c123 100644
--- a/Doc/c-api/init.rst
+++ b/Doc/c-api/init.rst
@@ -371,6 +371,10 @@ Initialization, Finalization, and Threads
Set the default "home" directory, that is, the location of the standard
Python libraries. The libraries are searched in
:file:`{home}/lib/python{version}` and :file:`{home}/lib/python{version}`.
+ The argument should point to a zero-terminated character string in static
+ storage whose contents will not change for the duration of the program's
+ execution. No code in the Python interpreter will change the contents of
+ this storage.
.. cfunction:: w_char* Py_GetPythonHome()
diff --git a/Doc/c-api/unicode.rst b/Doc/c-api/unicode.rst
index dc48158..4c0d6a4 100644
--- a/Doc/c-api/unicode.rst
+++ b/Doc/c-api/unicode.rst
@@ -476,10 +476,13 @@ These are the UTF-32 codec APIs:
*byteorder == 0: native order
*byteorder == 1: big endian
- and then switches if the first four bytes of the input data are a byte order mark
- (BOM) and the specified byte order is native order. This BOM is not copied into
- the resulting Unicode string. After completion, *\*byteorder* is set to the
- current byte order at the end of input data.
+ If ``*byteorder`` is zero, and the first four bytes of the input data are a
+ byte order mark (BOM), the decoder switches to this byte order and the BOM is
+ not copied into the resulting Unicode string. If ``*byteorder`` is ``-1`` or
+ ``1``, any byte order mark is copied to the output.
+
+ After completion, *\*byteorder* is set to the current byte order at the end
+ of input data.
In a narrow build codepoints outside the BMP will be decoded as surrogate pairs.
@@ -500,8 +503,7 @@ These are the UTF-32 codec APIs:
.. cfunction:: PyObject* PyUnicode_EncodeUTF32(const Py_UNICODE *s, Py_ssize_t size, const char *errors, int byteorder)
Return a Python bytes object holding the UTF-32 encoded value of the Unicode
- data in *s*. If *byteorder* is not ``0``, output is written according to the
- following byte order::
+ data in *s*. Output is written according to the following byte order::
byteorder == -1: little endian
byteorder == 0: native byte order (writes a BOM mark)
@@ -541,10 +543,14 @@ These are the UTF-16 codec APIs:
*byteorder == 0: native order
*byteorder == 1: big endian
- and then switches if the first two bytes of the input data are a byte order mark
- (BOM) and the specified byte order is native order. This BOM is not copied into
- the resulting Unicode string. After completion, *\*byteorder* is set to the
- current byte order at the end of input data.
+ If ``*byteorder`` is zero, and the first two bytes of the input data are a
+ byte order mark (BOM), the decoder switches to this byte order and the BOM is
+ not copied into the resulting Unicode string. If ``*byteorder`` is ``-1`` or
+ ``1``, any byte order mark is copied to the output (where it will result in
+ either a ``\ufeff`` or a ``\ufffe`` character).
+
+ After completion, *\*byteorder* is set to the current byte order at the end
+ of input data.
If *byteorder* is *NULL*, the codec starts in native order mode.
@@ -563,8 +569,7 @@ These are the UTF-16 codec APIs:
.. cfunction:: PyObject* PyUnicode_EncodeUTF16(const Py_UNICODE *s, Py_ssize_t size, const char *errors, int byteorder)
Return a Python bytes object holding the UTF-16 encoded value of the Unicode
- data in *s*. If *byteorder* is not ``0``, output is written according to the
- following byte order::
+ data in *s*. Output is written according to the following byte order::
byteorder == -1: little endian
byteorder == 0: native byte order (writes a BOM mark)