diff options
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/dictobject.c | 4 | ||||
-rw-r--r-- | Objects/longobject.c | 6 |
2 files changed, 7 insertions, 3 deletions
diff --git a/Objects/dictobject.c b/Objects/dictobject.c index 828803c..6f3ba1b 100644 --- a/Objects/dictobject.c +++ b/Objects/dictobject.c @@ -242,6 +242,10 @@ PyDict_New(void) _Py_NewReference((PyObject *)mp); if (mp->ma_fill) { EMPTY_TO_MINSIZE(mp); + } else { + /* At least set ma_table and ma_mask; these are wrong + if an empty but presized dict is added to freelist */ + INIT_NONZERO_DICT_SLOTS(mp); } assert (mp->ma_used == 0); assert (mp->ma_table == mp->ma_smalltable); diff --git a/Objects/longobject.c b/Objects/longobject.c index ae62cfd..3aa518b 100644 --- a/Objects/longobject.c +++ b/Objects/longobject.c @@ -271,12 +271,12 @@ PyLong_FromDouble(double dval) neg = 0; if (Py_IS_INFINITY(dval)) { PyErr_SetString(PyExc_OverflowError, - "cannot convert float infinity to int"); + "cannot convert float infinity to integer"); return NULL; } if (Py_IS_NAN(dval)) { - PyErr_SetString(PyExc_OverflowError, - "cannot convert float NaN to int"); + PyErr_SetString(PyExc_ValueError, + "cannot convert float NaN to integer"); return NULL; } if (dval < 0.0) { |