Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
Pyston
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
Pyston
Commits
2c1da404
Commit
2c1da404
authored
Aug 26, 2015
by
Boxiang Sun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
implement PyNumber_Float
parent
34532626
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
2 deletions
+13
-2
src/capi/abstract.cpp
src/capi/abstract.cpp
+13
-2
No files found.
src/capi/abstract.cpp
View file @
2c1da404
...
...
@@ -2118,6 +2118,18 @@ extern "C" PyObject* PyNumber_Float(PyObject* o) noexcept {
if
(
o
->
cls
==
float_cls
)
return
o
;
PyNumberMethods
*
m
;
m
=
o
->
cls
->
tp_as_number
;
if
(
m
&&
m
->
nb_float
)
{
/* This should include subclasses of float */
PyObject
*
res
=
m
->
nb_float
(
o
);
if
(
res
&&
!
PyFloat_Check
(
res
))
{
PyErr_Format
(
PyExc_TypeError
,
"__float__ returned non-float (type %.200s)"
,
res
->
cls
->
tp_name
);
Py_DECREF
(
res
);
return
NULL
;
}
return
res
;
}
if
(
PyInt_Check
(
o
))
return
boxFloat
(((
BoxedInt
*
)
o
)
->
n
);
else
if
(
PyLong_Check
(
o
))
{
...
...
@@ -2127,8 +2139,7 @@ extern "C" PyObject* PyNumber_Float(PyObject* o) noexcept {
return
boxFloat
(
result
);
}
fatalOrError
(
PyExc_NotImplementedError
,
"unimplemented"
);
return
nullptr
;
return
PyFloat_FromString
(
o
,
NULL
);
}
extern
"C"
PyObject
*
PyNumber_Index
(
PyObject
*
o
)
noexcept
{
...
...
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