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
765dd499
Commit
765dd499
authored
Apr 17, 2020
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify some redundant code by calling the obvious helper function instead.
parent
8db370d5
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
6 deletions
+4
-6
Cython/Utility/Optimize.c
Cython/Utility/Optimize.c
+4
-6
No files found.
Cython/Utility/Optimize.c
View file @
765dd499
...
...
@@ -596,11 +596,14 @@ static double __Pyx__PyObject_AsDouble(PyObject* obj); /* proto */
#endif
/////////////// pyobject_as_double ///////////////
//@requires: ObjectHandling.c::PyObjectCallOneArg
static
double
__Pyx__PyObject_AsDouble
(
PyObject
*
obj
)
{
PyObject
*
float_value
;
#if !CYTHON_USE_TYPE_SLOTS
float_value
=
PyNumber_Float
(
obj
);
if
((
0
))
goto
bad
;
// avoid "unused" warnings
(
void
)
__Pyx_PyObject_CallOneArg
;
#else
PyNumberMethods
*
nb
=
Py_TYPE
(
obj
)
->
tp_as_number
;
if
(
likely
(
nb
)
&&
likely
(
nb
->
nb_float
))
{
...
...
@@ -619,12 +622,7 @@ static double __Pyx__PyObject_AsDouble(PyObject* obj) {
float_value
=
PyFloat_FromString
(
obj
,
0
);
#endif
}
else
{
PyObject
*
args
=
PyTuple_New
(
1
);
if
(
unlikely
(
!
args
))
goto
bad
;
PyTuple_SET_ITEM
(
args
,
0
,
obj
);
float_value
=
PyObject_Call
((
PyObject
*
)
&
PyFloat_Type
,
args
,
0
);
PyTuple_SET_ITEM
(
args
,
0
,
0
);
Py_DECREF
(
args
);
float_value
=
__Pyx_PyObject_CallOneArg
((
PyObject
*
)
&
PyFloat_Type
,
obj
);
}
#endif
if
(
likely
(
float_value
))
{
...
...
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