Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cython
Commits
323d9b94
Commit
323d9b94
authored
Jun 11, 2020
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Avoid calling PyUnicode_FromUnicode() in Py3.
Closes
https://github.com/cython/cython/pull/3677
parent
9bc3fc65
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
2 deletions
+4
-2
Cython/Utility/StringTools.c
Cython/Utility/StringTools.c
+4
-2
No files found.
Cython/Utility/StringTools.c
View file @
323d9b94
...
...
@@ -443,6 +443,7 @@ static CYTHON_INLINE PyObject* __Pyx_decode_c_string(
/////////////// decode_c_string ///////////////
//@requires: IncludeStringH
//@requires: decode_c_string_utf16
//@substitute: naming
/* duplicate code to avoid calling strlen() if start >= 0 and stop >= 0 */
static
CYTHON_INLINE
PyObject
*
__Pyx_decode_c_string
(
...
...
@@ -467,7 +468,7 @@ static CYTHON_INLINE PyObject* __Pyx_decode_c_string(
stop
+=
length
;
}
if
(
unlikely
(
stop
<=
start
))
return
PyUnicode_FromUnicode
(
NULL
,
0
);
return
__Pyx_NewRef
(
$
empty_unicode
);
length
=
stop
-
start
;
cstring
+=
start
;
if
(
decode_func
)
{
...
...
@@ -486,6 +487,7 @@ static CYTHON_INLINE PyObject* __Pyx_decode_c_bytes(
/////////////// decode_c_bytes ///////////////
//@requires: decode_c_string_utf16
//@substitute: naming
static
CYTHON_INLINE
PyObject
*
__Pyx_decode_c_bytes
(
const
char
*
cstring
,
Py_ssize_t
length
,
Py_ssize_t
start
,
Py_ssize_t
stop
,
...
...
@@ -503,7 +505,7 @@ static CYTHON_INLINE PyObject* __Pyx_decode_c_bytes(
if
(
stop
>
length
)
stop
=
length
;
if
(
unlikely
(
stop
<=
start
))
return
PyUnicode_FromUnicode
(
NULL
,
0
);
return
__Pyx_NewRef
(
$
empty_unicode
);
length
=
stop
-
start
;
cstring
+=
start
;
if
(
decode_func
)
{
...
...
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