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
31375964
Commit
31375964
authored
Jul 10, 2012
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix (and simplify) object->double conversion in PyPy
parent
87b56a4b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
0 deletions
+9
-0
Cython/Utility/Optimize.c
Cython/Utility/Optimize.c
+9
-0
No files found.
Cython/Utility/Optimize.c
View file @
31375964
...
@@ -442,14 +442,22 @@ static CYTHON_INLINE int __Pyx_init_unicode_iteration(
...
@@ -442,14 +442,22 @@ static CYTHON_INLINE int __Pyx_init_unicode_iteration(
/////////////// pyobject_as_double.proto ///////////////
/////////////// pyobject_as_double.proto ///////////////
#if CYTHON_COMPILING_IN_PYPY
// currently works because PyPy calls float() internally
#define __Pyx_PyObject_AsDouble(obj) PyFloat_AsDouble(obj)
#else
static
double
__Pyx__PyObject_AsDouble
(
PyObject
*
obj
);
/* proto */
static
double
__Pyx__PyObject_AsDouble
(
PyObject
*
obj
);
/* proto */
#define __Pyx_PyObject_AsDouble(obj) \
#define __Pyx_PyObject_AsDouble(obj) \
((likely(PyFloat_CheckExact(obj))) ? \
((likely(PyFloat_CheckExact(obj))) ? \
PyFloat_AS_DOUBLE(obj) : __Pyx__PyObject_AsDouble(obj))
PyFloat_AS_DOUBLE(obj) : __Pyx__PyObject_AsDouble(obj))
#endif
/////////////// pyobject_as_double ///////////////
/////////////// pyobject_as_double ///////////////
#if !CYTHON_COMPILING_IN_PYPY
static
double
__Pyx__PyObject_AsDouble
(
PyObject
*
obj
)
{
static
double
__Pyx__PyObject_AsDouble
(
PyObject
*
obj
)
{
PyObject
*
float_value
;
PyObject
*
float_value
;
if
(
Py_TYPE
(
obj
)
->
tp_as_number
&&
Py_TYPE
(
obj
)
->
tp_as_number
->
nb_float
)
{
if
(
Py_TYPE
(
obj
)
->
tp_as_number
&&
Py_TYPE
(
obj
)
->
tp_as_number
->
nb_float
)
{
...
@@ -476,3 +484,4 @@ static double __Pyx__PyObject_AsDouble(PyObject* obj) {
...
@@ -476,3 +484,4 @@ static double __Pyx__PyObject_AsDouble(PyObject* obj) {
bad:
bad:
return
(
double
)
-
1
;
return
(
double
)
-
1
;
}
}
#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