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
0cae6619
Commit
0cae6619
authored
Nov 09, 2013
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
replace some redundant utility functions by explicit exceptions
parent
b6698160
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
51 deletions
+4
-51
Cython/Utility/ObjectHandling.c
Cython/Utility/ObjectHandling.c
+1
-1
Cython/Utility/StringTools.c
Cython/Utility/StringTools.c
+3
-50
No files found.
Cython/Utility/ObjectHandling.c
View file @
0cae6619
...
...
@@ -256,7 +256,7 @@ static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) {
#define __Pyx_GetItemInt_{{type}}(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck) \
(__Pyx_fits_Py_ssize_t(i, type, is_signed) ? \
__Pyx_GetItemInt_{{type}}_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) : \
__Pyx_GetItemInt_Generic(o, to_py_func(i)
))
(PyErr_SetString(PyExc_IndexError, "{{ type.lower() }} index out of range"), NULL
))
static
CYTHON_INLINE
PyObject
*
__Pyx_GetItemInt_
{{
type
}}
_Fast
(
PyObject
*
o
,
Py_ssize_t
i
,
int
wraparound
,
int
boundscheck
);
...
...
Cython/Utility/StringTools.c
View file @
0cae6619
...
...
@@ -232,11 +232,10 @@ static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int eq
#define __Pyx_GetItemInt_ByteArray(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck) \
(__Pyx_fits_Py_ssize_t(i, type, is_signed) ? \
__Pyx_GetItemInt_ByteArray_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) : \
__Pyx_GetItemInt_ByteArray_Generic(o, to_py_func(i)
))
(PyErr_SetString(PyExc_IndexError, "bytearray index out of range"), -1
))
static
CYTHON_INLINE
int
__Pyx_GetItemInt_ByteArray_Fast
(
PyObject
*
string
,
Py_ssize_t
i
,
int
wraparound
,
int
boundscheck
);
static
CYTHON_INLINE
int
__Pyx_GetItemInt_ByteArray_Generic
(
PyObject
*
string
,
PyObject
*
j
);
//////////////////// GetItemIntByteArray ////////////////////
...
...
@@ -257,29 +256,16 @@ static CYTHON_INLINE int __Pyx_GetItemInt_ByteArray_Fast(PyObject* string, Py_ss
}
}
static
CYTHON_INLINE
int
__Pyx_GetItemInt_ByteArray_Generic
(
PyObject
*
string
,
PyObject
*
j
)
{
unsigned
char
bchar
;
PyObject
*
bchar_string
;
if
(
!
j
)
return
-
1
;
bchar_string
=
PyObject_GetItem
(
string
,
j
);
Py_DECREF
(
j
);
if
(
!
bchar_string
)
return
-
1
;
bchar
=
(
unsigned
char
)
(
PyByteArray_AS_STRING
(
bchar_string
)[
0
]);
Py_DECREF
(
bchar_string
);
return
bchar
;
}
//////////////////// SetItemIntByteArray.proto ////////////////////
#define __Pyx_SetItemInt_ByteArray(o, i, v, type, is_signed, to_py_func, is_list, wraparound, boundscheck) \
(__Pyx_fits_Py_ssize_t(i, type, is_signed) ? \
__Pyx_SetItemInt_ByteArray_Fast(o, (Py_ssize_t)i, v, wraparound, boundscheck) : \
__Pyx_SetItemInt_ByteArray_Generic(o, to_py_func(i), v
))
(PyErr_SetString(PyExc_IndexError, "bytearray index out of range"), -1
))
static
CYTHON_INLINE
int
__Pyx_SetItemInt_ByteArray_Fast
(
PyObject
*
string
,
Py_ssize_t
i
,
unsigned
char
v
,
int
wraparound
,
int
boundscheck
);
static
CYTHON_INLINE
int
__Pyx_SetItemInt_ByteArray_Generic
(
PyObject
*
string
,
PyObject
*
j
,
unsigned
char
v
);
//////////////////// SetItemIntByteArray ////////////////////
...
...
@@ -302,32 +288,16 @@ static CYTHON_INLINE int __Pyx_SetItemInt_ByteArray_Fast(PyObject* string, Py_ss
}
}
static
CYTHON_INLINE
int
__Pyx_SetItemInt_ByteArray_Generic
(
PyObject
*
string
,
PyObject
*
j
,
unsigned
char
v
)
{
int
ret
;
PyObject
*
py_value
;
if
(
!
j
)
return
-
1
;
py_value
=
PyInt_FromLong
(
v
);
if
(
!
py_value
)
{
ret
=
-
1
;
}
else
{
ret
=
PyObject_SetItem
(
string
,
j
,
py_value
);
Py_DECREF
(
py_value
);
}
Py_DECREF
(
j
);
return
ret
;
}
//////////////////// GetItemIntUnicode.proto ////////////////////
#define __Pyx_GetItemInt_Unicode(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck) \
(__Pyx_fits_Py_ssize_t(i, type, is_signed) ? \
__Pyx_GetItemInt_Unicode_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) : \
__Pyx_GetItemInt_Unicode_Generic(o, to_py_func(i)
))
(PyErr_SetString(PyExc_IndexError, "string index out of range"), (Py_UCS4)-1
))
static
CYTHON_INLINE
Py_UCS4
__Pyx_GetItemInt_Unicode_Fast
(
PyObject
*
ustring
,
Py_ssize_t
i
,
int
wraparound
,
int
boundscheck
);
static
CYTHON_INLINE
Py_UCS4
__Pyx_GetItemInt_Unicode_Generic
(
PyObject
*
ustring
,
PyObject
*
j
);
//////////////////// GetItemIntUnicode ////////////////////
...
...
@@ -351,23 +321,6 @@ static CYTHON_INLINE Py_UCS4 __Pyx_GetItemInt_Unicode_Fast(PyObject* ustring, Py
}
}
static
CYTHON_INLINE
Py_UCS4
__Pyx_GetItemInt_Unicode_Generic
(
PyObject
*
ustring
,
PyObject
*
j
)
{
Py_UCS4
uchar
;
PyObject
*
uchar_string
;
if
(
!
j
)
return
(
Py_UCS4
)
-
1
;
uchar_string
=
PyObject_GetItem
(
ustring
,
j
);
Py_DECREF
(
j
);
if
(
!
uchar_string
)
return
(
Py_UCS4
)
-
1
;
#if CYTHON_PEP393_ENABLED
if
(
unlikely
(
__Pyx_PyUnicode_READY
(
uchar_string
)
<
0
))
{
Py_DECREF
(
uchar_string
);
return
(
Py_UCS4
)
-
1
;
}
#endif
uchar
=
__Pyx_PyUnicode_READ_CHAR
(
uchar_string
,
0
);
Py_DECREF
(
uchar_string
);
return
uchar
;
}
/////////////// decode_cpp_string.proto ///////////////
//@requires: IncludeCppStringH
...
...
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