File tree Expand file tree Collapse file tree 5 files changed +23
-6
lines changed
Expand file tree Collapse file tree 5 files changed +23
-6
lines changed Original file line number Diff line number Diff line change @@ -625,9 +625,13 @@ always available.
625625
626626.. data :: maxunicode
627627
628- An integer giving the largest supported code point for a Unicode character. The
629- value of this depends on the configuration option that specifies whether Unicode
630- characters are stored as UCS-2 or UCS-4.
628+ An integer giving the value of the largest Unicode code point,
629+ i.e. ``1114111 `` (``0x10FFFF `` in hexadecimal).
630+
631+ .. versionchanged :: 3.3
632+ Before :pep: `393 `, :data: `sys.maxunicode ` used to return either ``0xFFFF ``
633+ or ``0x10FFFF ``, depending on the configuration option that specified
634+ whether Unicode characters were stored as UCS-2 or UCS-4.
631635
632636
633637.. data :: meta_path
Original file line number Diff line number Diff line change @@ -55,6 +55,17 @@ PEP XXX: Stub
5555=============
5656
5757
58+ PEP 393: Flexible String Representation
59+ =======================================
60+
61+ XXX Add list of changes introduced by :pep: `393 ` here:
62+
63+ * The value of :data: `sys.maxunicode ` is now always ``1114111 `` (``0x10FFFF ``
64+ in hexadecimal). The :c:func: `PyUnicode_GetMax ` function still returns
65+ either ``0xFFFF `` or ``0x10FFFF `` for backward compatibility, and it should
66+ not be used with the new Unicode API (see :issue: `13054 `).
67+
68+
5869Other Language Changes
5970======================
6071
Original file line number Diff line number Diff line change @@ -447,6 +447,7 @@ def test_attributes(self):
447447
448448 self .assertIsInstance (sys .maxsize , int )
449449 self .assertIsInstance (sys .maxunicode , int )
450+ self .assertEqual (sys .maxunicode , 0x10FFFF )
450451 self .assertIsInstance (sys .platform , str )
451452 self .assertIsInstance (sys .prefix , str )
452453 self .assertIsInstance (sys .version , str )
Original file line number Diff line number Diff line change @@ -207,7 +207,8 @@ static unsigned char ascii_linebreak[] = {
207207 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0
208208};
209209
210-
210+ /* The max unicode value is always 0x10FFFF while using the PEP-393 API.
211+ This function is kept for backward compatibility with the old API. */
211212Py_UNICODE
212213PyUnicode_GetMax (void )
213214{
Original file line number Diff line number Diff line change @@ -1261,7 +1261,7 @@ float_repr_style -- string indicating the style of repr() output for floats\n\
12611261hexversion -- version information encoded as a single integer\n\
12621262int_info -- a struct sequence with information about the int implementation.\n\
12631263maxsize -- the largest supported length of containers.\n\
1264- maxunicode -- the largest supported character \n\
1264+ maxunicode -- the value of the largest Unicode codepoint \n\
12651265platform -- platform identifier\n\
12661266prefix -- prefix used to find the Python library\n\
12671267thread_info -- a struct sequence with information about the thread implementation.\n\
@@ -1536,7 +1536,7 @@ _PySys_Init(void)
15361536 SET_SYS_FROM_STRING ("hash_info" ,
15371537 get_hash_info ());
15381538 SET_SYS_FROM_STRING ("maxunicode" ,
1539- PyLong_FromLong (PyUnicode_GetMax () ));
1539+ PyLong_FromLong (0x10FFFF ));
15401540 SET_SYS_FROM_STRING ("builtin_module_names" ,
15411541 list_builtin_module_names ());
15421542 {
You can’t perform that action at this time.
0 commit comments