@@ -580,8 +580,9 @@ Major performance enhancements have been added:
580580* Thanks to the :pep: `393 `, some operations on Unicode strings has been optimized:
581581
582582 * the memory footprint is divided by 2 to 4 depending on the text
583+ * encode an ASCII string to UTF-8 doesn't need to encode characters anymore,
584+ the UTF-8 representation is shared with the ASCII representation
583585 * getting a substring of a latin1 strings is 4 times faster
584- * TODO
585586
586587
587588Build and C API Changes
@@ -591,25 +592,30 @@ Changes to Python's build process and to the C API include:
591592
592593* The :pep: `393 ` added new Unicode types, macros and functions:
593594
594- * Py_UCS1, Py_UCS2, Py_UCS4 types
595- * PyASCIIObject and PyCompactUnicodeObject structures
596- * :c:func: `PyUnicode_New `
597- * :c:macro: `PyUnicode_READY `
598- * :c:func: `PyUnicode_FromKindAndData `
599- * :c:func: `PyUnicode_GetLength `, :c:macro: `PyUnicode_GET_LENGTH `
600- * :c:func: `PyUnicode_CopyCharacters `
601- * :c:func: `PyUnicode_ReadChar `, :c:func: `PyUnicode_WriteChar `
602- * :c:func: `PyUnicode_AsUCS4 `, :c:func: `PyUnicode_AsUCS4Copy `
603- * :c:func: `PyUnicode_FindChar `
604- * :c:func: `PyUnicode_Substring `
605- * :c:macro: `PyUnicode_1BYTE_DATA `, :c:macro: `PyUnicode_2BYTE_DATA `,
606- :c:macro: `PyUnicode_4BYTE_DATA `
607- * :c:macro: `PyUnicode_KIND ` with :c:type: `PyUnicode_Kind ` enum:
608- :c:data: `PyUnicode_WCHAR_KIND `, :c:data: `PyUnicode_1BYTE_KIND `,
609- :c:data: `PyUnicode_2BYTE_KIND `, :c:data: `PyUnicode_4BYTE_KIND `
610- * :c:macro: `PyUnicode_DATA `
611- * :c:macro: `PyUnicode_READ `, :c:macro: `PyUnicode_READ_CHAR `, :c:macro: `PyUnicode_WRITE `
612- * :c:macro: `PyUnicode_MAX_CHAR_VALUE `
595+ * High-level API:
596+
597+ * :c:func: `PyUnicode_CopyCharacters `
598+ * :c:func: `PyUnicode_FindChar `
599+ * :c:func: `PyUnicode_GetLength `, :c:macro: `PyUnicode_GET_LENGTH `
600+ * :c:func: `PyUnicode_New `
601+ * :c:func: `PyUnicode_Substring `
602+ * :c:func: `PyUnicode_ReadChar `, :c:func: `PyUnicode_WriteChar `
603+
604+ * Low-level API:
605+
606+ * :c:type: `Py_UCS1 `, :c:type: `Py_UCS2 `, :c:type: `Py_UCS4 ` types
607+ * :c:type: `PyASCIIObject ` and :c:type: `PyCompactUnicodeObject ` structures
608+ * :c:macro: `PyUnicode_READY `
609+ * :c:func: `PyUnicode_FromKindAndData `
610+ * :c:func: `PyUnicode_AsUCS4 `, :c:func: `PyUnicode_AsUCS4Copy `
611+ * :c:macro: `PyUnicode_DATA `, :c:macro: `PyUnicode_1BYTE_DATA `,
612+ :c:macro: `PyUnicode_2BYTE_DATA `, :c:macro: `PyUnicode_4BYTE_DATA `
613+ * :c:macro: `PyUnicode_KIND ` with :c:type: `PyUnicode_Kind ` enum:
614+ :c:data: `PyUnicode_WCHAR_KIND `, :c:data: `PyUnicode_1BYTE_KIND `,
615+ :c:data: `PyUnicode_2BYTE_KIND `, :c:data: `PyUnicode_4BYTE_KIND `
616+ * :c:macro: `PyUnicode_READ `, :c:macro: `PyUnicode_READ_CHAR `, :c:macro: `PyUnicode_WRITE `
617+ * :c:macro: `PyUnicode_MAX_CHAR_VALUE `
618+
613619
614620
615621Unsupported Operating Systems
@@ -643,21 +649,6 @@ Deprecated functions and types of the C API
643649The :c:type: `Py_UNICODE ` has been deprecated by the :pep: `393 ` and will be
644650removed in Python 4. All functions using this type are deprecated:
645651
646- Functions and macros manipulating Py_UNICODE* strings:
647-
648- * :c:macro: `Py_UNICODE_strlen `: use :c:func: `PyUnicode_GetLength ` or
649- :c:macro: `PyUnicode_GET_LENGTH `
650- * :c:macro: `Py_UNICODE_strcat `: use :c:func: `PyUnicode_CopyCharacters ` or
651- :c:func: `PyUnicode_FromFormat `
652- * :c:macro: `Py_UNICODE_strcpy `, :c:macro: `Py_UNICODE_strncpy `,
653- :c:macro: `Py_UNICODE_COPY `: use :c:func: `PyUnicode_CopyCharacters ` or
654- :c:func: `PyUnicode_Substring `
655- * :c:macro: `Py_UNICODE_strcmp `: use :c:func: `PyUnicode_Compare `
656- * :c:macro: `Py_UNICODE_strncmp `: use :c:func: `PyUnicode_Tailmatch `
657- * :c:macro: `Py_UNICODE_strchr `, :c:macro: `Py_UNICODE_strrchr `: use
658- :c:func: `PyUnicode_FindChar `
659- * :c:macro: `Py_UNICODE_FILL `
660-
661652Unicode functions and methods using :c:type: `Py_UNICODE ` and
662653:c:type: `Py_UNICODE* ` types:
663654
@@ -675,11 +666,27 @@ Unicode functions and methods using :c:type:`Py_UNICODE` and
675666 * :c:func: `PyUnicode_AsUnicodeCopy `: use :c:func: `PyUnicode_AsUCS4Copy `,
676667 :c:func: `PyUnicode_AsWideCharString ` or :c:func: `PyUnicode_Copy `
677668
669+ Functions and macros manipulating Py_UNICODE* strings:
670+
671+ * :c:macro: `Py_UNICODE_strlen `: use :c:func: `PyUnicode_GetLength ` or
672+ :c:macro: `PyUnicode_GET_LENGTH `
673+ * :c:macro: `Py_UNICODE_strcat `: use :c:func: `PyUnicode_CopyCharacters ` or
674+ :c:func: `PyUnicode_FromFormat `
675+ * :c:macro: `Py_UNICODE_strcpy `, :c:macro: `Py_UNICODE_strncpy `,
676+ :c:macro: `Py_UNICODE_COPY `: use :c:func: `PyUnicode_CopyCharacters ` or
677+ :c:func: `PyUnicode_Substring `
678+ * :c:macro: `Py_UNICODE_strcmp `: use :c:func: `PyUnicode_Compare `
679+ * :c:macro: `Py_UNICODE_strncmp `: use :c:func: `PyUnicode_Tailmatch `
680+ * :c:macro: `Py_UNICODE_strchr `, :c:macro: `Py_UNICODE_strrchr `: use
681+ :c:func: `PyUnicode_FindChar `
682+ * :c:macro: `Py_UNICODE_FILL `
683+
678684Encoders:
679685
680686 * :c:func: `PyUnicode_Encode `: use :c:func: `PyUnicode_AsEncodedObject `
681687 * :c:func: `PyUnicode_EncodeUTF7 `
682- * :c:func: `PyUnicode_EncodeUTF8 `: use :c:func: `PyUnicode_AsUTF8String `
688+ * :c:func: `PyUnicode_EncodeUTF8 `: use :c:func: `PyUnicode_AsUTF8 ` or
689+ :c:func: `PyUnicode_AsUTF8String `
683690 * :c:func: `PyUnicode_EncodeUTF32 `
684691 * :c:func: `PyUnicode_EncodeUTF16 `
685692 * :c:func: `PyUnicode_EncodeUnicodeEscape: ` use
0 commit comments