Fix typos and whitespace in PEP-393.
This commit is contained in:
parent
5e4bc1147e
commit
e8a7d6bc87
10
pep-0393.txt
10
pep-0393.txt
|
@ -118,7 +118,7 @@ The fields have the following interpretations:
|
|||
(implies ready)
|
||||
- ascii: the object uses the PyASCIIObject representation
|
||||
(implies compact and ready)
|
||||
- ready: the canonical represenation is ready to be accessed through
|
||||
- ready: the canonical representation is ready to be accessed through
|
||||
PyUnicode_DATA and PyUnicode_GET_LENGTH. This is set either if the
|
||||
object is compact, or the data pointer and length have been
|
||||
initialized.
|
||||
|
@ -160,7 +160,7 @@ Both parameters must denote the eventual size/range of the strings.
|
|||
In particular, codecs using this API must compute both the number of
|
||||
characters and the maximum character in advance. An string is
|
||||
allocated according to the specified size and character range and is
|
||||
null-terminated; the actual characters in it may be unitialized.
|
||||
null-terminated; the actual characters in it may be uninitialized.
|
||||
|
||||
PyUnicode_FromString and PyUnicode_FromStringAndSize remain supported
|
||||
for processing UTF-8 input; the input is decoded, and the UTF-8
|
||||
|
@ -314,7 +314,7 @@ ready, and then continue accessing the (now invalid) Py_UNICODE
|
|||
pointer. Such code will break with this PEP. The code was already
|
||||
flawed in 3.2, as there is was no explicit guarantee that the
|
||||
PyUnicode_AS_UNICODE result would stay valid after an API call (due to
|
||||
the possiblity of string resizing). Modules that face this issue
|
||||
the possibility of string resizing). Modules that face this issue
|
||||
need to re-fetch the Py_UNICODE pointer after API calls; doing
|
||||
so will continue to work correctly in earlier Python versions.
|
||||
|
||||
|
@ -395,7 +395,7 @@ characters, use indexing operations rather than pointer arithmetic;
|
|||
indexing works well for PyUnicode_READ(_CHAR) and PyUnicode_WRITE. Use
|
||||
void* as the buffer type for characters to let the compiler detect
|
||||
invalid dereferencing operations. If you do want to use pointer
|
||||
arithmentics (e.g. when converting existing code), use (unsigned)
|
||||
arithmetics (e.g. when converting existing code), use (unsigned)
|
||||
char* as the buffer type, and keep the element size (1, 2, or 4) in a
|
||||
variable. Notice that (1<<(kind-1)) will produce the element size
|
||||
given a buffer kind.
|
||||
|
@ -428,7 +428,7 @@ maximum character.
|
|||
For common tasks, direct access to the string representation may not
|
||||
be necessary: PyUnicode_Find, PyUnicode_FindChar, PyUnicode_Ord, and
|
||||
PyUnicode_CopyCharacters help in analyzing and creating string
|
||||
objects, operating on indices instead of data pointers.
|
||||
objects, operating on indexes instead of data pointers.
|
||||
|
||||
References
|
||||
==========
|
||||
|
|
Loading…
Reference in New Issue