summaryrefslogtreecommitdiff
path: root/Objects/unicodeobject.c
diff options
context:
space:
mode:
authorEzio Melotti <ezio.melotti@gmail.com>2012-10-05 03:34:02 +0300
committerEzio Melotti <ezio.melotti@gmail.com>2012-10-05 03:34:02 +0300
commit080a2c087e5fa08c44ff121d74ea8ad9d4413c58 (patch)
treef5bcece562167593f10ac72f539415f46d269d14 /Objects/unicodeobject.c
parentb176203ddab0671fb937c488492f4a535a37c639 (diff)
parente7f90375b175ed9e610a1de3b5c910f9271375ad (diff)
downloadcpython-git-080a2c087e5fa08c44ff121d74ea8ad9d4413c58.tar.gz
#16127: merge with 3.3.
Diffstat (limited to 'Objects/unicodeobject.c')
-rw-r--r--Objects/unicodeobject.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index c28d1802fc..daeb4b4db5 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -5800,18 +5800,12 @@ PyUnicode_AsUnicodeEscapeString(PyObject *unicode)
void *data;
Py_ssize_t expandsize = 0;
- /* Initial allocation is based on the longest-possible unichr
+ /* Initial allocation is based on the longest-possible character
escape.
- In wide (UTF-32) builds '\U00xxxxxx' is 10 chars per source
- unichr, so in this case it's the longest unichr escape. In
- narrow (UTF-16) builds this is five chars per source unichr
- since there are two unichrs in the surrogate pair, so in narrow
- (UTF-16) builds it's not the longest unichr escape.
-
- In wide or narrow builds '\uxxxx' is 6 chars per source unichr,
- so in the narrow (UTF-16) build case it's the longest unichr
- escape.
+ For UCS1 strings it's '\xxx', 4 bytes per source character.
+ For UCS2 strings it's '\uxxxx', 6 bytes per source character.
+ For UCS4 strings it's '\U00xxxxxx', 10 bytes per source character.
*/
if (!PyUnicode_Check(unicode)) {