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
7b574d54
Commit
7b574d54
authored
Aug 14, 2014
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tiny bit more streamlined and less redundant call implementation
parent
828f64ae
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
37 deletions
+44
-37
Cython/Utility/ObjectHandling.c
Cython/Utility/ObjectHandling.c
+44
-37
No files found.
Cython/Utility/ObjectHandling.c
View file @
7b574d54
...
...
@@ -1158,32 +1158,19 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg
#endif
/////////////// PyObjectCall
OneArg
.proto ///////////////
/////////////// PyObjectCall
MethO
.proto ///////////////
static
CYTHON_INLINE
PyObject
*
__Pyx_PyObject_CallOneArg
(
PyObject
*
func
,
PyObject
*
arg
);
/*proto*/
#if CYTHON_COMPILING_IN_CPYTHON
static
CYTHON_INLINE
PyObject
*
__Pyx_PyObject_CallMethO
(
PyObject
*
func
,
PyObject
*
arg
);
/*proto*/
#endif
/////////////// PyObjectCall
OneArg
///////////////
/////////////// PyObjectCall
MethO
///////////////
//@requires: PyObjectCall
#if CYTHON_COMPILING_IN_CPYTHON
static
CYTHON_INLINE
PyObject
*
__Pyx_PyObject_Call
OneArg
(
PyObject
*
func
,
PyObject
*
arg
)
{
static
CYTHON_INLINE
PyObject
*
__Pyx_PyObject_Call
MethO
(
PyObject
*
func
,
PyObject
*
arg
)
{
PyObject
*
self
,
*
result
;
PyCFunction
cfunc
;
if
(
!
(
PyCFunction_Check
(
func
)
#ifdef __Pyx_CyFunction_USED
||
PyObject_TypeCheck
(
func
,
__pyx_CyFunctionType
)
#endif
)
||
!
(
PyCFunction_GET_FLAGS
(
func
)
&
METH_O
))
{
PyObject
*
args
=
PyTuple_New
(
1
);
if
(
unlikely
(
!
args
))
return
NULL
;
PyTuple_SET_ITEM
(
args
,
0
,
arg
);
Py_INCREF
(
arg
);
result
=
__Pyx_PyObject_Call
(
func
,
args
,
NULL
);
Py_DECREF
(
args
);
return
result
;
}
// fast and simple case we are optimising for
cfunc
=
PyCFunction_GET_FUNCTION
(
func
);
self
=
PyCFunction_GET_SELF
(
func
);
...
...
@@ -1198,6 +1185,37 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObjec
}
return
result
;
}
#endif
/////////////// PyObjectCallOneArg.proto ///////////////
static
CYTHON_INLINE
PyObject
*
__Pyx_PyObject_CallOneArg
(
PyObject
*
func
,
PyObject
*
arg
);
/*proto*/
/////////////// PyObjectCallOneArg ///////////////
//@requires: PyObjectCallMethO
//@requires: PyObjectCall
#if CYTHON_COMPILING_IN_CPYTHON
static
CYTHON_INLINE
PyObject
*
__Pyx_PyObject_CallOneArg
(
PyObject
*
func
,
PyObject
*
arg
)
{
if
(
likely
(
PyCFunction_Check
(
func
)
#ifdef __Pyx_CyFunction_USED
||
PyObject_TypeCheck
(
func
,
__pyx_CyFunctionType
)
#endif
)
&&
likely
(
PyCFunction_GET_FLAGS
(
func
)
&
METH_O
))
{
// fast and simple case that we are optimising for
return
__Pyx_PyObject_CallMethO
(
func
,
arg
);
}
else
{
PyObject
*
result
;
PyObject
*
args
=
PyTuple_New
(
1
);
if
(
unlikely
(
!
args
))
return
NULL
;
Py_INCREF
(
arg
);
PyTuple_SET_ITEM
(
args
,
0
,
arg
);
result
=
__Pyx_PyObject_Call
(
func
,
args
,
NULL
);
Py_DECREF
(
args
);
return
result
;
}
}
#else
static
CYTHON_INLINE
PyObject
*
__Pyx_PyObject_CallOneArg
(
PyObject
*
func
,
PyObject
*
arg
)
{
...
...
@@ -1217,33 +1235,22 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func); /*proto
#endif
/////////////// PyObjectCallNoArg ///////////////
//@requires: PyObjectCallMethO
//@requires: PyObjectCall
//@substitute: naming
#if CYTHON_COMPILING_IN_CPYTHON
static
CYTHON_INLINE
PyObject
*
__Pyx_PyObject_CallNoArg
(
PyObject
*
func
)
{
PyObject
*
self
,
*
result
;
PyCFunction
cfunc
;
if
(
!
(
PyCFunction_Check
(
func
)
if
(
likely
(
PyCFunction_Check
(
func
)
#ifdef __Pyx_CyFunction_USED
||
PyObject_TypeCheck
(
func
,
__pyx_CyFunctionType
)
||
PyObject_TypeCheck
(
func
,
__pyx_CyFunctionType
)
#endif
)
||
!
(
PyCFunction_GET_FLAGS
(
func
)
&
METH_NOARGS
))
{
)
&&
likely
(
PyCFunction_GET_FLAGS
(
func
)
&
METH_NOARGS
))
{
// fast and simple case that we are optimising for
return
__Pyx_PyObject_CallMethO
(
func
,
NULL
);
}
else
{
return
__Pyx_PyObject_Call
(
func
,
$
empty_tuple
,
NULL
);
}
cfunc
=
PyCFunction_GET_FUNCTION
(
func
);
self
=
PyCFunction_GET_SELF
(
func
);
if
(
unlikely
(
Py_EnterRecursiveCall
((
char
*
)
" while calling a Python object"
)))
return
NULL
;
result
=
cfunc
(
self
,
NULL
);
Py_LeaveRecursiveCall
();
if
(
unlikely
(
!
result
)
&&
unlikely
(
!
PyErr_Occurred
()))
{
PyErr_SetString
(
PyExc_SystemError
,
"NULL result without error in PyObject_Call"
);
}
return
result
;
}
#endif
...
...
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