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

Skip to content

Commit 4327910

Browse files
committed
Bill Tutt: Added Py_UCS4 typedef to hold UCS4 values (these need
at least 32 bits as opposed to Py_UNICODE which rely on having 16 bits).
1 parent e4dbb86 commit 4327910

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

Include/unicodeobject.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,17 @@ typedef unsigned short Py_UNICODE;
107107

108108
#endif
109109

110+
/*
111+
* Use this typedef when you need to represent a UTF-16 surrogate pair
112+
* as single unsigned integer.
113+
*/
114+
#if SIZEOF_INT >= 4
115+
typedef unsigned int Py_UCS4;
116+
#elif SIZEOF_LONG >= 4
117+
typedef unsigned long Py_UCS4;
118+
#endif
119+
120+
110121
/* --- Internal Unicode Operations ---------------------------------------- */
111122

112123
/* If you want Python to use the compiler's wctype.h functions instead

0 commit comments

Comments
 (0)