summaryrefslogtreecommitdiffstats
path: root/Objects/dictobject.c
diff options
context:
space:
mode:
Diffstat (limited to 'Objects/dictobject.c')
-rw-r--r--Objects/dictobject.c32
1 files changed, 17 insertions, 15 deletions
diff --git a/Objects/dictobject.c b/Objects/dictobject.c
index 1deb26c..bacb705 100644
--- a/Objects/dictobject.c
+++ b/Objects/dictobject.c
@@ -217,8 +217,8 @@ reported by this function, and outstanding exceptions are maintained.
static dictentry *
lookdict(dictobject *mp, PyObject *key, register long hash)
{
- register int i;
- register unsigned int perturb;
+ register Py_ssize_t i;
+ register size_t perturb;
register dictentry *freeslot;
register unsigned int mask = mp->ma_mask;
dictentry *ep0 = mp->ma_table;
@@ -328,8 +328,8 @@ Done:
static dictentry *
lookdict_string(dictobject *mp, PyObject *key, register long hash)
{
- register int i;
- register unsigned int perturb;
+ register Py_ssize_t i;
+ register size_t perturb;
register dictentry *freeslot;
register unsigned int mask = mp->ma_mask;
dictentry *ep0 = mp->ma_table;
@@ -690,9 +690,10 @@ PyDict_Clear(PyObject *op)
* delete keys), via PyDict_SetItem().
*/
int
-PyDict_Next(PyObject *op, int *ppos, PyObject **pkey, PyObject **pvalue)
+PyDict_Next(PyObject *op, Py_ssize_t *ppos, PyObject **pkey, PyObject **pvalue)
{
- register int i, mask;
+ register Py_ssize_t i;
+ register int mask;
register dictentry *ep;
if (!PyDict_Check(op))
@@ -786,7 +787,7 @@ dict_print(register dictobject *mp, register FILE *fp, register int flags)
static PyObject *
dict_repr(dictobject *mp)
{
- int i;
+ Py_ssize_t i;
PyObject *s, *temp, *colon = NULL;
PyObject *pieces = NULL, *result = NULL;
PyObject *key, *value;
@@ -862,7 +863,7 @@ Done:
return result;
}
-static int
+static Py_ssize_t
dict_length(dictobject *mp)
{
return mp->ma_used;
@@ -898,7 +899,7 @@ dict_ass_sub(dictobject *mp, PyObject *v, PyObject *w)
}
static PyMappingMethods dict_as_mapping = {
- (inquiry)dict_length, /*mp_length*/
+ (lenfunc)dict_length, /*mp_length*/
(binaryfunc)dict_subscript, /*mp_subscript*/
(objobjargproc)dict_ass_sub, /*mp_ass_subscript*/
};
@@ -1109,7 +1110,7 @@ int
PyDict_MergeFromSeq2(PyObject *d, PyObject *seq2, int override)
{
PyObject *it; /* iter(seq2) */
- int i; /* index into seq2 of current element */
+ int i; /* index into seq2 of current element */
PyObject *item; /* seq2[i] */
PyObject *fast; /* item as a 2-tuple or 2-list */
@@ -1123,7 +1124,7 @@ PyDict_MergeFromSeq2(PyObject *d, PyObject *seq2, int override)
for (i = 0; ; ++i) {
PyObject *key, *value;
- int n;
+ Py_ssize_t n;
fast = NULL;
item = PyIter_Next(it);
@@ -1147,7 +1148,7 @@ PyDict_MergeFromSeq2(PyObject *d, PyObject *seq2, int override)
if (n != 2) {
PyErr_Format(PyExc_ValueError,
"dictionary update sequence element #%d "
- "has length %d; 2 is required",
+ "has length %ld; 2 is required",
i, n);
goto Fail;
}
@@ -1300,7 +1301,7 @@ PyDict_Copy(PyObject *o)
return NULL;
}
-int
+Py_ssize_t
PyDict_Size(PyObject *mp)
{
if (mp == NULL || !PyDict_Check(mp)) {
@@ -1708,7 +1709,8 @@ dict_popitem(dictobject *mp)
static int
dict_traverse(PyObject *op, visitproc visit, void *arg)
{
- int i = 0, err;
+ Py_ssize_t i = 0;
+ int err;
PyObject *pk;
PyObject *pv;
@@ -2057,7 +2059,7 @@ dictiter_dealloc(dictiterobject *di)
static PyObject *
dictiter_len(dictiterobject *di)
{
- int len = 0;
+ long len = 0;
if (di->di_dict != NULL && di->di_used == di->di_dict->ma_used)
len = di->len;
return PyInt_FromLong(len);