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
Kirill Smelkov
cython
Commits
ba195179
Commit
ba195179
authored
Nov 20, 2020
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make underscore number parsing independent of "CYTHON_USE_TYPE_SLOTS" guard.
parent
b738fd8c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
27 deletions
+26
-27
Cython/Utility/Optimize.c
Cython/Utility/Optimize.c
+26
-27
No files found.
Cython/Utility/Optimize.c
View file @
ba195179
...
...
@@ -601,41 +601,40 @@ static double __Pyx__PyObject_AsDouble(PyObject* obj); /* proto */
//@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
;
(
void
)
__Pyx_PyBytes_AsDouble
;
(
void
)
__Pyx_PyByteArray_AsDouble
;
(
void
)
__Pyx_PyUnicode_AsDouble
;
#else
PyNumberMethods
*
nb
=
Py_TYPE
(
obj
)
->
tp_as_number
;
if
(
PyUnicode_CheckExact
(
obj
))
{
return
__Pyx_PyUnicode_AsDouble
(
obj
);
}
else
if
(
PyBytes_CheckExact
(
obj
))
{
return
__Pyx_PyBytes_AsDouble
(
obj
);
}
else
if
(
PyByteArray_CheckExact
(
obj
))
{
return
__Pyx_PyByteArray_AsDouble
(
obj
);
}
else
if
(
likely
(
nb
)
&&
likely
(
nb
->
nb_float
))
{
float_value
=
nb
->
nb_float
(
obj
);
if
(
likely
(
float_value
)
&&
unlikely
(
!
PyFloat_Check
(
float_value
)))
{
__Pyx_TypeName
float_value_type_name
=
__Pyx_PyType_GetName
(
Py_TYPE
(
float_value
));
PyErr_Format
(
PyExc_TypeError
,
"__float__ returned non-float (type "
__Pyx_FMT_TYPENAME
")"
,
float_value_type_name
);
__Pyx_DECREF_TypeName
(
float_value_type_name
);
Py_DECREF
(
float_value
);
goto
bad
;
}
}
else
{
float_value
=
__Pyx_PyObject_CallOneArg
((
PyObject
*
)
&
PyFloat_Type
,
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
))
{
float_value
=
nb
->
nb_float
(
obj
);
if
(
likely
(
float_value
)
&&
unlikely
(
!
PyFloat_Check
(
float_value
)))
{
__Pyx_TypeName
float_value_type_name
=
__Pyx_PyType_GetName
(
Py_TYPE
(
float_value
));
PyErr_Format
(
PyExc_TypeError
,
"__float__ returned non-float (type "
__Pyx_FMT_TYPENAME
")"
,
float_value_type_name
);
__Pyx_DECREF_TypeName
(
float_value_type_name
);
Py_DECREF
(
float_value
);
goto
bad
;
}
}
else
{
float_value
=
__Pyx_PyObject_CallOneArg
((
PyObject
*
)
&
PyFloat_Type
,
obj
);
}
#endif
if
(
likely
(
float_value
))
{
double
value
=
PyFloat_AS_DOUBLE
(
float_value
);
Py_DECREF
(
float_value
);
return
value
;
if
(
likely
(
float_value
))
{
double
value
=
PyFloat_AS_DOUBLE
(
float_value
);
Py_DECREF
(
float_value
);
return
value
;
}
}
bad:
return
(
double
)
-
1
;
...
...
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