summaryrefslogtreecommitdiff
path: root/Objects/floatobject.c
diff options
context:
space:
mode:
Diffstat (limited to 'Objects/floatobject.c')
-rw-r--r--Objects/floatobject.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/Objects/floatobject.c b/Objects/floatobject.c
index acd88d6fd3..d92bec35b5 100644
--- a/Objects/floatobject.c
+++ b/Objects/floatobject.c
@@ -1001,8 +1001,9 @@ float_round(PyObject *v, PyObject *args)
x = PyFloat_AsDouble(v);
if (!PyArg_ParseTuple(args, "|O", &o_ndigits))
return NULL;
- if (o_ndigits == NULL) {
- /* single-argument round: round to nearest integer */
+ if (o_ndigits == NULL || o_ndigits == Py_None) {
+ /* single-argument round or with None ndigits:
+ * round to nearest integer */
rounded = round(x);
if (fabs(x-rounded) == 0.5)
/* halfway case: round to even */
@@ -2048,7 +2049,7 @@ _PyFloat_Pack4(double x, unsigned char *p, int le)
}
else {
float y = (float)x;
- const char *s = (char*)&y;
+ const unsigned char *s = (unsigned char*)&y;
int i, incr = 1;
if (Py_IS_INFINITY(y) && !Py_IS_INFINITY(x))
@@ -2184,7 +2185,7 @@ _PyFloat_Pack8(double x, unsigned char *p, int le)
return -1;
}
else {
- const char *s = (char*)&x;
+ const unsigned char *s = (unsigned char*)&x;
int i, incr = 1;
if ((double_format == ieee_little_endian_format && !le)