Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
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
Kirill Smelkov
cpython
Commits
a915723d
Commit
a915723d
authored
Mar 06, 2015
by
Benjamin Peterson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix potential refleak in PyFloat_AsDouble (closes #23590)
parent
b5a23223
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
0 deletions
+7
-0
Lib/test/test_float.py
Lib/test/test_float.py
+6
-0
Objects/floatobject.c
Objects/floatobject.c
+1
-0
No files found.
Lib/test/test_float.py
View file @
a915723d
...
...
@@ -6,6 +6,7 @@ from test import support
import
math
from
math
import
isinf
,
isnan
,
copysign
,
ldexp
import
operator
import
time
import
random
,
fractions
INF
=
float
(
"inf"
)
...
...
@@ -129,6 +130,11 @@ class GeneralFloatCases(unittest.TestCase):
self
.
assertRaises
(
TypeError
,
float
,
Foo4
(
42
))
self
.
assertAlmostEqual
(
float
(
FooStr
(
'8'
)),
9.
)
class
Foo5
:
def
__float__
(
self
):
return
""
self
.
assertRaises
(
TypeError
,
time
.
sleep
,
Foo5
())
def
test_is_integer
(
self
):
self
.
assertFalse
((
1.1
).
is_integer
())
self
.
assertTrue
((
1.
).
is_integer
())
...
...
Objects/floatobject.c
View file @
a915723d
...
...
@@ -220,6 +220,7 @@ PyFloat_AsDouble(PyObject *op)
if
(
fo
==
NULL
)
return
-
1
;
if
(
!
PyFloat_Check
(
fo
))
{
Py_DECREF
(
fo
);
PyErr_SetString
(
PyExc_TypeError
,
"nb_float should return float object"
);
return
-
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