Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
e064aeaa
Commit
e064aeaa
authored
Nov 21, 2016
by
Serhiy Storchaka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #28760: Clean up and fix comments in PyUnicode_AsUnicodeEscapeString().
Patch by Xiang Zhang.
parent
5cc68968
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
10 deletions
+4
-10
Objects/unicodeobject.c
Objects/unicodeobject.c
+4
-10
No files found.
Objects/unicodeobject.c
View file @
e064aeaa
...
...
@@ -6134,12 +6134,7 @@ PyUnicode_DecodeUnicodeEscape(const char *s,
return
result
;
}
/* Return a Unicode-Escape string version of the Unicode object.
If quotes is true, the string is enclosed in u"" or u'' quotes as
appropriate.
*/
/* Return a Unicode-Escape string version of the Unicode object. */
PyObject
*
PyUnicode_AsUnicodeEscapeString
(
PyObject
*
unicode
)
...
...
@@ -6177,10 +6172,10 @@ PyUnicode_AsUnicodeEscapeString(PyObject *unicode)
/* 4 byte characters can take up 10 bytes, 2 byte characters can take up 6
bytes, and 1 byte characters 4. */
expandsize
=
kind
*
2
+
2
;
if
(
len
>
(
PY_SSIZE_T_MAX
-
2
-
1
)
/
expandsize
)
{
if
(
len
>
PY_SSIZE_T_MAX
/
expandsize
)
{
return
PyErr_NoMemory
();
}
repr
=
PyBytes_FromStringAndSize
(
NULL
,
2
+
expandsize
*
len
+
1
);
repr
=
PyBytes_FromStringAndSize
(
NULL
,
expandsize
*
len
);
if
(
repr
==
NULL
)
{
return
NULL
;
}
...
...
@@ -6225,9 +6220,8 @@ PyUnicode_AsUnicodeEscapeString(PyObject *unicode)
*
p
++
=
Py_hexdigits
[
ch
&
0x000F
];
}
}
/* U+0
000-U+00
ff range: Map 16-bit characters to '\uHHHH' */
/* U+0
100-U+ff
ff range: Map 16-bit characters to '\uHHHH' */
else
if
(
ch
<
0x10000
)
{
/* U+0100-U+ffff */
*
p
++
=
'\\'
;
*
p
++
=
'u'
;
*
p
++
=
Py_hexdigits
[(
ch
>>
12
)
&
0x000F
];
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment