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
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
cython
Commits
0b27c6a5
Commit
0b27c6a5
authored
Aug 23, 2011
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cleanup, use global #define to enable PEP393 support
parent
b6fcad18
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
11 deletions
+10
-11
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+9
-11
Cython/Compiler/ModuleNode.py
Cython/Compiler/ModuleNode.py
+1
-0
No files found.
Cython/Compiler/ExprNodes.py
View file @
0b27c6a5
...
...
@@ -7045,22 +7045,20 @@ static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int
if (s1 == s2) { /* as done by PyObject_RichCompareBool(); also catches the (interned) empty string */
return (equals == Py_EQ);
} else if (PyUnicode_CheckExact(s1) & PyUnicode_CheckExact(s2)) {
#ifdef
PyUnicode_GET_LENGTH /* PEP 393 */
#ifdef
CYTHON_PEP393_ENABLED
if (PyUnicode_GET_LENGTH(s1) != PyUnicode_GET_LENGTH(s2)) {
return (equals == Py_NE);
} else if (PyUnicode_GET_LENGTH(s1) == 1) {
if (equals == Py_EQ)
return (PyUnicode_READ_CHAR(s1, 0) == PyUnicode_READ_CHAR(s2, 0));
else
return (PyUnicode_READ_CHAR(s1, 0) != PyUnicode_READ_CHAR(s2, 0));
Py_UCS4 ch1 = PyUnicode_READ_CHAR(s1, 0);
Py_UCS4 ch2 = PyUnicode_READ_CHAR(s2, 0);
return (equals == Py_EQ) ? (ch1 == ch2) : (ch1 != ch2);
#else
if (PyUnicode_GET_SIZE(s1) != PyUnicode_GET_SIZE(s2)) {
return (equals == Py_NE);
} else if (PyUnicode_GET_SIZE(s1) == 1) {
if (equals == Py_EQ)
return (PyUnicode_AS_UNICODE(s1)[0] == PyUnicode_AS_UNICODE(s2)[0]);
else
return (PyUnicode_AS_UNICODE(s1)[0] != PyUnicode_AS_UNICODE(s2)[0]);
Py_UNICODE ch1 = PyUnicode_AS_UNICODE(s1)[0];
Py_UNICODE ch2 = PyUnicode_AS_UNICODE(s2)[0];
return (equals == Py_EQ) ? (ch1 == ch2) : (ch1 != ch2);
#endif
} else {
int result = PyUnicode_Compare(s1, s2);
...
...
@@ -8428,7 +8426,7 @@ proto = '''
__Pyx_GetItemInt_Unicode_Generic(o, to_py_func(i)))
static CYTHON_INLINE Py_UCS4 __Pyx_GetItemInt_Unicode_Fast(PyObject* ustring, Py_ssize_t i) {
#ifdef
PyUnicode_GET_LENGTH
#ifdef
CYTHON_PEP393_ENABLED
if (likely((0 <= i) & (i < PyUnicode_GET_LENGTH(ustring)))) {
return PyUnicode_READ_CHAR(ustring, i);
} else if ((-PyUnicode_GET_LENGTH(ustring) <= i) & (i < 0)) {
...
...
@@ -8454,7 +8452,7 @@ static CYTHON_INLINE Py_UCS4 __Pyx_GetItemInt_Unicode_Generic(PyObject* ustring,
uchar_string = PyObject_GetItem(ustring, j);
Py_DECREF(j);
if (!uchar_string) return (Py_UCS4)-1;
#ifdef
PyUnicode_GET_LENGTH
#ifdef
CYTHON_PEP393_ENABLED
uchar = PyUnicode_READ_CHAR(uchar_string, 0);
#else
uchar = (Py_UCS4)PyUnicode_AS_UNICODE(ustring)[0];
...
...
Cython/Compiler/ModuleNode.py
View file @
0b27c6a5
...
...
@@ -580,6 +580,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
/* new Py3.3 unicode representation (PEP 393) */
#ifdef PyUnicode_GET_LENGTH
#define CYTHON_PEP393_ENABLED
#define __Pyx_PyUnicode_GET_LENGTH PyUnicode_GET_LENGTH
#else
#define __Pyx_PyUnicode_GET_LENGTH PyUnicode_GET_SIZE
...
...
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