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
Gwenaël Samain
cython
Commits
59c060ae
Commit
59c060ae
authored
Aug 25, 2011
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
properly handle error cases for PEP 393 __Pyx_PyUnicode_Equals()
parent
71c84cd2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
1 deletion
+4
-1
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+4
-1
No files found.
Cython/Compiler/ExprNodes.py
View file @
59c060ae
...
@@ -7052,13 +7052,16 @@ pyunicode_equals_utility_code = UtilityCode(
...
@@ -7052,13 +7052,16 @@ pyunicode_equals_utility_code = UtilityCode(
proto
=
"""
proto
=
"""
static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals); /*proto*/
static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals); /*proto*/
"""
,
"""
,
# FIXME: call PyUnicode_FAST_READY() in the PEP 393 case and propagate potential errors
impl
=
"""
impl
=
"""
static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) {
static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) {
if (s1 == s2) { /* as done by PyObject_RichCompareBool(); also catches the (interned) empty string */
if (s1 == s2) { /* as done by PyObject_RichCompareBool(); also catches the (interned) empty string */
return (equals == Py_EQ);
return (equals == Py_EQ);
} else if (PyUnicode_CheckExact(s1) & PyUnicode_CheckExact(s2)) {
} else if (PyUnicode_CheckExact(s1) & PyUnicode_CheckExact(s2)) {
#ifdef CYTHON_PEP393_ENABLED
#ifdef CYTHON_PEP393_ENABLED
if (PyUnicode_FAST_READY(s1) < 0)
return -1;
if (PyUnicode_FAST_READY(s2) < 0)
return -1;
if (PyUnicode_GET_LENGTH(s1) != PyUnicode_GET_LENGTH(s2)) {
if (PyUnicode_GET_LENGTH(s1) != PyUnicode_GET_LENGTH(s2)) {
return (equals == Py_NE);
return (equals == Py_NE);
} else if (PyUnicode_GET_LENGTH(s1) == 1) {
} else if (PyUnicode_GET_LENGTH(s1) == 1) {
...
...
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