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
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 = '''
...
@@ -8426,19 +8426,11 @@ proto = '''
__Pyx_GetItemInt_Unicode_Generic(o, to_py_func(i)))
__Pyx_GetItemInt_Unicode_Generic(o, to_py_func(i)))
static CYTHON_INLINE Py_UCS4 __Pyx_GetItemInt_Unicode_Fast(PyObject* ustring, Py_ssize_t i) {
static CYTHON_INLINE Py_UCS4 __Pyx_GetItemInt_Unicode_Fast(PyObject* ustring, Py_ssize_t i) {
#ifdef CYTHON_PEP393_ENABLED
const Py_ssize_t length = __Pyx_PyUnicode_GET_LENGTH(ustring);
if (likely((0 <= i) & (i < PyUnicode_GET_LENGTH(ustring)))) {
if (likely((0 <= i) & (i < length))) {
return PyUnicode_READ_CHAR(ustring, i);
return __Pyx_PyUnicode_READ_CHAR(ustring, i);
} else if ((-PyUnicode_GET_LENGTH(ustring) <= i) & (i < 0)) {
} else if ((-length <= i) & (i < 0)) {
i += PyUnicode_GET_LENGTH(ustring);
return __Pyx_PyUnicode_READ_CHAR(ustring, i + length);
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
} else {
} else {
PyErr_SetString(PyExc_IndexError, "string index out of range");
PyErr_SetString(PyExc_IndexError, "string index out of range");
return (Py_UCS4)-1;
return (Py_UCS4)-1;
...
@@ -8452,11 +8444,7 @@ static CYTHON_INLINE Py_UCS4 __Pyx_GetItemInt_Unicode_Generic(PyObject* ustring,
...
@@ -8452,11 +8444,7 @@ static CYTHON_INLINE Py_UCS4 __Pyx_GetItemInt_Unicode_Generic(PyObject* ustring,
uchar_string = PyObject_GetItem(ustring, j);
uchar_string = PyObject_GetItem(ustring, j);
Py_DECREF(j);
Py_DECREF(j);
if (!uchar_string) return (Py_UCS4)-1;
if (!uchar_string) return (Py_UCS4)-1;
#ifdef CYTHON_PEP393_ENABLED
uchar = __Pyx_PyUnicode_READ_CHAR(uchar_string, 0);
uchar = PyUnicode_READ_CHAR(uchar_string, 0);
#else
uchar = (Py_UCS4)PyUnicode_AS_UNICODE(ustring)[0];
#endif
Py_DECREF(uchar_string);
Py_DECREF(uchar_string);
return uchar;
return uchar;
}
}
...
...
Cython/Compiler/ModuleNode.py
View file @
85d9b64b
...
@@ -579,13 +579,13 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
...
@@ -579,13 +579,13 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
#endif
#endif
/* new Py3.3 unicode representation (PEP 393) */
/* 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 CYTHON_PEP393_ENABLED
#define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u)
#define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u)
#define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
#define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
#else
#else
#define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u)
#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
#endif
#if PY_MAJOR_VERSION >= 3
#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