diff options
author | Guido van Rossum <guido@python.org> | 1991-06-03 10:58:01 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1991-06-03 10:58:01 (GMT) |
commit | ad40531aa199f0532777a336a6961a46afa11eac (patch) | |
tree | 8859c9b244e506c8819be2493690ecd57119736d | |
parent | 246b9d8258e7d7adbeed152a6377a6b541ad2020 (diff) | |
download | cpython-ad40531aa199f0532777a336a6961a46afa11eac.zip cpython-ad40531aa199f0532777a336a6961a46afa11eac.tar.gz cpython-ad40531aa199f0532777a336a6961a46afa11eac.tar.bz2 |
Fix conversion of double to long; stylistic changes.
-rw-r--r-- | Python/bltinmodule.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c index 9768cd7..47dc920 100644 --- a/Python/bltinmodule.c +++ b/Python/bltinmodule.c @@ -171,7 +171,6 @@ builtin_float(self, v) return newfloatobject((double)x); } else if (is_longobject(v)) { - extern double dgetlongvalue(); return newfloatobject(dgetlongvalue(v)); } else if (is_floatobject(v)) { @@ -215,12 +214,13 @@ builtin_int(self, v) else if (is_longobject(v)) { long x; x = getlongvalue(v); - if (x == -1 && err_occurred()) + if (err_occurred()) return NULL; return newintobject(x); } else if (is_floatobject(v)) { double x = getfloatvalue(v); + /* XXX should check for overflow */ return newintobject((long)x); } err_setstr(TypeError, "int() argument must be int, long or float"); @@ -269,7 +269,7 @@ builtin_long(self, v) } else if (is_floatobject(v)) { double x = getfloatvalue(v); - return newlongobject((long)x); + return dnewlongobject(x); } err_setstr(TypeError, "long() argument must be int, long or float"); return NULL; |