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
743e95bd
Commit
743e95bd
authored
Aug 08, 1996
by
Guido van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Include mymath.h instead of declaring prototypes for math functions.
Fix leak and unchecked error in complex().
parent
df8a2752
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
5 deletions
+13
-5
Python/bltinmodule.c
Python/bltinmodule.c
+13
-5
No files found.
Python/bltinmodule.c
View file @
743e95bd
...
...
@@ -33,6 +33,8 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include "compile.h"
#include "eval.h"
#include "mymath.h"
/* Forward */
static
object
*
filterstring
PROTO
((
object
*
,
object
*
));
static
object
*
filtertuple
PROTO
((
object
*
,
object
*
));
...
...
@@ -284,7 +286,7 @@ builtin_complex(self, args)
object
*
self
;
object
*
args
;
{
object
*
r
,
*
i
;
object
*
r
,
*
i
,
*
tmp
;
number_methods
*
nbr
,
*
nbi
;
Py_complex
cr
,
ci
;
...
...
@@ -302,7 +304,11 @@ builtin_complex(self, args)
if
(
is_complexobject
(
r
))
cr
=
((
complexobject
*
)
r
)
->
cval
;
else
{
cr
.
real
=
getfloatvalue
((
*
nbr
->
nb_float
)(
r
));
tmp
=
(
*
nbr
->
nb_float
)(
r
);
if
(
tmp
==
NULL
)
return
NULL
;
cr
.
real
=
getfloatvalue
(
tmp
);
DECREF
(
tmp
);
cr
.
imag
=
0
.;
}
if
(
i
==
NULL
)
{
...
...
@@ -312,7 +318,11 @@ builtin_complex(self, args)
else
if
(
is_complexobject
(
i
))
ci
=
((
complexobject
*
)
i
)
->
cval
;
else
{
ci
.
real
=
getfloatvalue
((
*
nbi
->
nb_float
)(
i
));
tmp
=
(
*
nbr
->
nb_float
)(
r
);
if
(
tmp
==
NULL
)
return
NULL
;
ci
.
real
=
getfloatvalue
(
tmp
);
DECREF
(
tmp
);
ci
.
imag
=
0
.;
}
cr
.
real
-=
ci
.
imag
;
...
...
@@ -1354,8 +1364,6 @@ builtin_round(self, args)
object
*
self
;
object
*
args
;
{
extern
double
floor
PROTO
((
double
));
extern
double
ceil
PROTO
((
double
));
double
x
;
double
f
;
int
ndigits
=
0
;
...
...
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