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
079309a2
Commit
079309a2
authored
Feb 16, 2013
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
streamline fallback method calls in utility code
parent
10c8bc1a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
5 deletions
+34
-5
Cython/Utility/Generator.c
Cython/Utility/Generator.c
+2
-1
Cython/Utility/ObjectHandling.c
Cython/Utility/ObjectHandling.c
+24
-0
Cython/Utility/Optimize.c
Cython/Utility/Optimize.c
+8
-4
No files found.
Cython/Utility/Generator.c
View file @
079309a2
...
@@ -56,6 +56,7 @@ static int __Pyx_PyGen_FetchStopIterationValue(PyObject **pvalue);
...
@@ -56,6 +56,7 @@ static int __Pyx_PyGen_FetchStopIterationValue(PyObject **pvalue);
//@requires: Exceptions.c::PyErrFetchRestore
//@requires: Exceptions.c::PyErrFetchRestore
//@requires: Exceptions.c::SwapException
//@requires: Exceptions.c::SwapException
//@requires: Exceptions.c::RaiseException
//@requires: Exceptions.c::RaiseException
//@requires: ObjectHandling.c::PyObjectCallMethod
static
PyObject
*
__Pyx_Generator_Next
(
PyObject
*
self
);
static
PyObject
*
__Pyx_Generator_Next
(
PyObject
*
self
);
static
PyObject
*
__Pyx_Generator_Send
(
PyObject
*
self
,
PyObject
*
value
);
static
PyObject
*
__Pyx_Generator_Send
(
PyObject
*
self
,
PyObject
*
value
);
...
@@ -285,7 +286,7 @@ static PyObject *__Pyx_Generator_Send(PyObject *self, PyObject *value) {
...
@@ -285,7 +286,7 @@ static PyObject *__Pyx_Generator_Send(PyObject *self, PyObject *value) {
if
(
value
==
Py_None
)
if
(
value
==
Py_None
)
ret
=
PyIter_Next
(
yf
);
ret
=
PyIter_Next
(
yf
);
else
else
ret
=
PyObject_CallMethod
(
yf
,
(
char
*
)
"send"
,
(
char
*
)
"O"
,
value
);
ret
=
__Pyx_PyObject_CallMethod1
(
yf
,
PYIDENT
(
"send"
)
,
value
);
}
}
gen
->
is_running
=
0
;
gen
->
is_running
=
0
;
//Py_DECREF(yf);
//Py_DECREF(yf);
...
...
Cython/Utility/ObjectHandling.c
View file @
079309a2
...
@@ -585,3 +585,27 @@ static CYTHON_INLINE int __Pyx_PySequence_Contains(PyObject* item, PyObject* seq
...
@@ -585,3 +585,27 @@ static CYTHON_INLINE int __Pyx_PySequence_Contains(PyObject* item, PyObject* seq
static
CYTHON_INLINE
PyObject
*
__Pyx_PyBoolOrNull_FromLong
(
long
b
)
{
static
CYTHON_INLINE
PyObject
*
__Pyx_PyBoolOrNull_FromLong
(
long
b
)
{
return
unlikely
(
b
<
0
)
?
NULL
:
__Pyx_PyBool_FromLong
(
b
);
return
unlikely
(
b
<
0
)
?
NULL
:
__Pyx_PyBool_FromLong
(
b
);
}
}
/////////////// PyObjectCallMethod.proto ///////////////
//@substitute: naming
static
PyObject
*
__Pyx_PyObject_CallMethodTuple
(
PyObject
*
obj
,
PyObject
*
method_name
,
PyObject
*
args
)
{
PyObject
*
method
,
*
result
=
NULL
;
if
(
unlikely
(
!
args
))
return
NULL
;
method
=
PyObject_GetAttr
(
obj
,
method_name
);
if
(
unlikely
(
!
method
))
goto
bad
;
result
=
PyObject_Call
(
method
,
args
,
NULL
);
Py_DECREF
(
method
);
bad:
Py_DECREF
(
args
);
return
result
;
}
#define __Pyx_PyObject_CallMethod3(obj, name, arg1, arg2, arg3) \
__Pyx_PyObject_CallMethodTuple(obj, name, PyTuple_Pack(3, arg1, arg2, arg3));
#define __Pyx_PyObject_CallMethod2(obj, name, arg1, arg2) \
__Pyx_PyObject_CallMethodTuple(obj, name, PyTuple_Pack(2, arg1, arg2));
#define __Pyx_PyObject_CallMethod1(obj, name, arg1) \
__Pyx_PyObject_CallMethodTuple(obj, name, PyTuple_Pack(1, arg1));
#define __Pyx_PyObject_CallMethod0(obj, name) \
__Pyx_PyObject_CallMethodTuple(obj, name, (Py_INCREF($empty_tuple), $empty_tuple));
Cython/Utility/Optimize.c
View file @
079309a2
...
@@ -4,6 +4,7 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_Append(PyObject* L, PyObject* x);
...
@@ -4,6 +4,7 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_Append(PyObject* L, PyObject* x);
/////////////// append ///////////////
/////////////// append ///////////////
//@requires: ListAppend
//@requires: ListAppend
//@requires: ObjectHandling.c::PyObjectCallMethod
static
CYTHON_INLINE
PyObject
*
__Pyx_PyObject_Append
(
PyObject
*
L
,
PyObject
*
x
)
{
static
CYTHON_INLINE
PyObject
*
__Pyx_PyObject_Append
(
PyObject
*
L
,
PyObject
*
x
)
{
if
(
likely
(
PyList_CheckExact
(
L
)))
{
if
(
likely
(
PyList_CheckExact
(
L
)))
{
...
@@ -11,7 +12,7 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_Append(PyObject* L, PyObject* x) {
...
@@ -11,7 +12,7 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_Append(PyObject* L, PyObject* x) {
Py_INCREF
(
Py_None
);
Py_INCREF
(
Py_None
);
return
Py_None
;
/* this is just to have an accurate signature */
return
Py_None
;
/* this is just to have an accurate signature */
}
else
{
}
else
{
return
PyObject_CallMethodObjArgs
(
L
,
PYIDENT
(
"append"
),
x
,
NULL
);
return
__Pyx_PyObject_CallMethod1
(
L
,
PYIDENT
(
"append"
),
x
);
}
}
}
}
...
@@ -56,6 +57,7 @@ static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) {
...
@@ -56,6 +57,7 @@ static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) {
static
CYTHON_INLINE
PyObject
*
__Pyx_PyObject_Pop
(
PyObject
*
L
);
/*proto*/
static
CYTHON_INLINE
PyObject
*
__Pyx_PyObject_Pop
(
PyObject
*
L
);
/*proto*/
/////////////// pop ///////////////
/////////////// pop ///////////////
//@requires: ObjectHandling.c::PyObjectCallMethod
static
CYTHON_INLINE
PyObject
*
__Pyx_PyObject_Pop
(
PyObject
*
L
)
{
static
CYTHON_INLINE
PyObject
*
__Pyx_PyObject_Pop
(
PyObject
*
L
)
{
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x02040000
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x02040000
...
@@ -71,7 +73,7 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_Pop(PyObject* L) {
...
@@ -71,7 +73,7 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_Pop(PyObject* L) {
}
}
#endif
#endif
#endif
#endif
return
PyObject_CallMethodObjArgs
(
L
,
PYIDENT
(
"pop"
),
NULL
);
return
__Pyx_PyObject_CallMethod0
(
L
,
PYIDENT
(
"pop"
)
);
}
}
...
@@ -318,6 +320,7 @@ static PyObject* __Pyx_PyDict_GetItemDefault(PyObject* d, PyObject* key, PyObjec
...
@@ -318,6 +320,7 @@ static PyObject* __Pyx_PyDict_GetItemDefault(PyObject* d, PyObject* key, PyObjec
static
CYTHON_INLINE
PyObject
*
__Pyx_PyDict_SetDefault
(
PyObject
*
d
,
PyObject
*
key
,
PyObject
*
default_value
,
int
is_safe_type
);
/*proto*/
static
CYTHON_INLINE
PyObject
*
__Pyx_PyDict_SetDefault
(
PyObject
*
d
,
PyObject
*
key
,
PyObject
*
default_value
,
int
is_safe_type
);
/*proto*/
/////////////// dict_setdefault ///////////////
/////////////// dict_setdefault ///////////////
//@requires: ObjectHandling.c::PyObjectCallMethod
static
CYTHON_INLINE
PyObject
*
__Pyx_PyDict_SetDefault
(
PyObject
*
d
,
PyObject
*
key
,
PyObject
*
default_value
,
int
is_safe_type
)
{
static
CYTHON_INLINE
PyObject
*
__Pyx_PyDict_SetDefault
(
PyObject
*
d
,
PyObject
*
key
,
PyObject
*
default_value
,
int
is_safe_type
)
{
PyObject
*
value
;
PyObject
*
value
;
...
@@ -344,7 +347,7 @@ static CYTHON_INLINE PyObject *__Pyx_PyDict_SetDefault(PyObject *d, PyObject *ke
...
@@ -344,7 +347,7 @@ static CYTHON_INLINE PyObject *__Pyx_PyDict_SetDefault(PyObject *d, PyObject *ke
Py_INCREF
(
value
);
Py_INCREF
(
value
);
#endif
#endif
}
else
{
}
else
{
value
=
PyObject_CallMethodObjArgs
(
d
,
PYIDENT
(
"setdefault"
),
key
,
default_value
,
NULL
);
value
=
__Pyx_PyObject_CallMethod2
(
d
,
PYIDENT
(
"setdefault"
),
key
,
default_value
);
}
}
return
value
;
return
value
;
}
}
...
@@ -412,6 +415,7 @@ static CYTHON_INLINE int __Pyx_dict_iter_next(PyObject* dict_or_iter, Py_ssize_t
...
@@ -412,6 +415,7 @@ static CYTHON_INLINE int __Pyx_dict_iter_next(PyObject* dict_or_iter, Py_ssize_t
/////////////// dict_iter ///////////////
/////////////// dict_iter ///////////////
//@requires: ObjectHandling.c::UnpackTuple2
//@requires: ObjectHandling.c::UnpackTuple2
//@requires: ObjectHandling.c::IterFinish
//@requires: ObjectHandling.c::IterFinish
//@requires: ObjectHandling.c::PyObjectCallMethod
static
CYTHON_INLINE
PyObject
*
__Pyx_dict_iterator
(
PyObject
*
iterable
,
int
is_dict
,
PyObject
*
method_name
,
static
CYTHON_INLINE
PyObject
*
__Pyx_dict_iterator
(
PyObject
*
iterable
,
int
is_dict
,
PyObject
*
method_name
,
Py_ssize_t
*
p_orig_length
,
int
*
p_source_is_dict
)
{
Py_ssize_t
*
p_orig_length
,
int
*
p_source_is_dict
)
{
...
@@ -427,7 +431,7 @@ static CYTHON_INLINE PyObject* __Pyx_dict_iterator(PyObject* iterable, int is_di
...
@@ -427,7 +431,7 @@ static CYTHON_INLINE PyObject* __Pyx_dict_iterator(PyObject* iterable, int is_di
*
p_orig_length
=
0
;
*
p_orig_length
=
0
;
if
(
method_name
)
{
if
(
method_name
)
{
PyObject
*
iter
;
PyObject
*
iter
;
iterable
=
PyObject_CallMethodObjArgs
(
iterable
,
method_name
,
NULL
);
iterable
=
__Pyx_PyObject_CallMethod0
(
iterable
,
method_name
);
if
(
!
iterable
)
if
(
!
iterable
)
return
NULL
;
return
NULL
;
#if !CYTHON_COMPILING_IN_PYPY
#if !CYTHON_COMPILING_IN_PYPY
...
...
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