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
Boxiang Sun
cython
Commits
f2955a60
Commit
f2955a60
authored
Sep 07, 2014
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use generic "__Pyx_PyUnicode_READY()" macro instead of checking for PEP393 all over the place
parent
bd388a4e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
15 deletions
+5
-15
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+1
-3
Cython/Utility/StringTools.c
Cython/Utility/StringTools.c
+3
-11
Cython/Utility/TypeConversion.c
Cython/Utility/TypeConversion.c
+1
-1
No files found.
Cython/Compiler/ExprNodes.py
View file @
f2955a60
...
...
@@ -1384,10 +1384,8 @@ class UnicodeNode(ConstNode):
data_cname
,
data_cname
,
code
.
error_goto_if_null
(
self
.
result_code
,
self
.
pos
)))
code
.
putln
(
"#if CYTHON_PEP393_ENABLED"
)
code
.
put_error_if_neg
(
self
.
pos
,
"PyUnicode_READY(%s)"
%
self
.
result_code
)
code
.
putln
(
"#endif"
)
self
.
pos
,
"__Pyx_PyUnicode_READY(%s)"
%
self
.
result_code
)
else
:
self
.
result_code
=
code
.
get_py_string_const
(
self
.
value
)
else
:
...
...
Cython/Utility/StringTools.c
View file @
f2955a60
...
...
@@ -170,10 +170,8 @@ static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int
Py_ssize_t
length
;
int
kind
;
void
*
data1
,
*
data2
;
#if CYTHON_PEP393_ENABLED
if
(
unlikely
(
PyUnicode_READY
(
s1
)
<
0
)
||
unlikely
(
PyUnicode_READY
(
s2
)
<
0
))
if
(
unlikely
(
__Pyx_PyUnicode_READY
(
s1
)
<
0
)
||
unlikely
(
__Pyx_PyUnicode_READY
(
s2
)
<
0
))
return
-
1
;
#endif
length
=
__Pyx_PyUnicode_GET_LENGTH
(
s1
);
if
(
length
!=
__Pyx_PyUnicode_GET_LENGTH
(
s2
))
{
goto
return_ne
;
...
...
@@ -346,9 +344,7 @@ static CYTHON_INLINE Py_UCS4 __Pyx_GetItemInt_Unicode_Fast(PyObject* ustring, Py
static
CYTHON_INLINE
Py_UCS4
__Pyx_GetItemInt_Unicode_Fast
(
PyObject
*
ustring
,
Py_ssize_t
i
,
int
wraparound
,
int
boundscheck
)
{
Py_ssize_t
length
;
#if CYTHON_PEP393_ENABLED
if
(
unlikely
(
__Pyx_PyUnicode_READY
(
ustring
)
<
0
))
return
(
Py_UCS4
)
-
1
;
#endif
if
(
wraparound
|
boundscheck
)
{
length
=
__Pyx_PyUnicode_GET_LENGTH
(
ustring
);
if
(
wraparound
&
unlikely
(
i
<
0
))
i
+=
length
;
...
...
@@ -483,12 +479,8 @@ static CYTHON_INLINE PyObject* __Pyx_PyUnicode_Substring(
static
CYTHON_INLINE
PyObject
*
__Pyx_PyUnicode_Substring
(
PyObject
*
text
,
Py_ssize_t
start
,
Py_ssize_t
stop
)
{
Py_ssize_t
length
;
#if CYTHON_PEP393_ENABLED
if
(
unlikely
(
PyUnicode_READY
(
text
)
==
-
1
))
return
NULL
;
length
=
PyUnicode_GET_LENGTH
(
text
);
#else
length
=
PyUnicode_GET_SIZE
(
text
);
#endif
if
(
unlikely
(
__Pyx_PyUnicode_READY
(
text
)
==
-
1
))
return
NULL
;
length
=
__Pyx_PyUnicode_GET_LENGTH
(
text
);
if
(
start
<
0
)
{
start
+=
length
;
if
(
start
<
0
)
...
...
Cython/Utility/TypeConversion.c
View file @
f2955a60
...
...
@@ -192,7 +192,7 @@ static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_
*
length
=
PyBytes_GET_SIZE
(
defenc
);
return
defenc_c
;
#else
/* PY_VERSION_HEX < 0x03030000 */
if
(
PyUnicode_READY
(
o
)
==
-
1
)
return
NULL
;
if
(
__Pyx_
PyUnicode_READY
(
o
)
==
-
1
)
return
NULL
;
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
if
(
PyUnicode_IS_ASCII
(
o
))
{
// cached for the lifetime of the object
...
...
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