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
85d9b64b
Commit
85d9b64b
authored
Aug 23, 2011
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cleanup, fix copy&paste error in generic unicode indexing
parent
f9d67af3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
20 deletions
+8
-20
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+6
-18
Cython/Compiler/ModuleNode.py
Cython/Compiler/ModuleNode.py
+2
-2
No files found.
Cython/Compiler/ExprNodes.py
View file @
85d9b64b
...
...
@@ -8426,19 +8426,11 @@ 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 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)) {
i += PyUnicode_GET_LENGTH(ustring);
return PyUnicode_READ_CHAR(ustring, i);
#else
if (likely((0 <= i) & (i < PyUnicode_GET_SIZE(ustring)))) {
return (Py_UCS4)PyUnicode_AS_UNICODE(ustring)[i];
} else if ((-PyUnicode_GET_SIZE(ustring) <= i) & (i < 0)) {
i += PyUnicode_GET_SIZE(ustring);
return (Py_UCS4)PyUnicode_AS_UNICODE(ustring)[i];
#endif
const Py_ssize_t length = __Pyx_PyUnicode_GET_LENGTH(ustring);
if (likely((0 <= i) & (i < length))) {
return __Pyx_PyUnicode_READ_CHAR(ustring, i);
} else if ((-length <= i) & (i < 0)) {
return __Pyx_PyUnicode_READ_CHAR(ustring, i + length);
} else {
PyErr_SetString(PyExc_IndexError, "string index out of range");
return (Py_UCS4)-1;
...
...
@@ -8452,11 +8444,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 CYTHON_PEP393_ENABLED
uchar = PyUnicode_READ_CHAR(uchar_string, 0);
#else
uchar = (Py_UCS4)PyUnicode_AS_UNICODE(ustring)[0];
#endif
uchar = __Pyx_PyUnicode_READ_CHAR(uchar_string, 0);
Py_DECREF(uchar_string);
return uchar;
}
...
...
Cython/Compiler/ModuleNode.py
View file @
85d9b64b
...
...
@@ -579,13 +579,13 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
#endif
/* new Py3.3 unicode representation (PEP 393) */
#if
def PyUnicode_GET_LENGTH
#if
PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_GET_LENGTH)
#define CYTHON_PEP393_ENABLED
#define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u)
#define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
#else
#define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u)
#define __Pyx_PyUnicode_READ_CHAR(u, i) (
PyUnicode_AS_UNICODE(u)[i]
)
#define __Pyx_PyUnicode_READ_CHAR(u, i) (
(Py_UCS4)(PyUnicode_AS_UNICODE(u)[i])
)
#endif
#if PY_MAJOR_VERSION >= 3
...
...
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