]> granicus.if.org Git - python/commitdiff
Correct some value converting strangenesses.
authorGeorg Brandl <georg@python.org>
Mon, 29 May 2006 19:39:45 +0000 (19:39 +0000)
committerGeorg Brandl <georg@python.org>
Mon, 29 May 2006 19:39:45 +0000 (19:39 +0000)
Modules/binascii.c
Modules/mmapmodule.c
Objects/classobject.c
Objects/object.c

index 4623b7cd61fa95860bc91ae252f3ffd7b4506d11..71a962452ecc4891975cb160f447b324cdc1f6bf 100644 (file)
@@ -644,7 +644,7 @@ binascii_rledecode_hqx(PyObject *self, PyObject *args)
 
        /* Empty string is a special case */
        if ( in_len == 0 )
-               return Py_BuildValue("s", "");
+               return PyString_FromString("");
 
        /* Allocate a buffer of reasonable size. Resized when needed */
        out_len = in_len*2;
index 2e34a9f7fd0bc1166183e72647398a8e0646ebbb..2e74e37ff22c74e7c384e3592f47c29ca5610072 100644 (file)
@@ -477,7 +477,7 @@ mmap_tell_method(mmap_object *self, PyObject *args)
        CHECK_VALID(NULL);
         if (!PyArg_ParseTuple(args, ":tell"))
                return NULL;
-       return Py_BuildValue("l", (long) self->pos);
+       return PyInt_FromLong((long) self->pos);
 }
 
 static PyObject *
@@ -493,7 +493,7 @@ mmap_flush_method(mmap_object *self, PyObject *args)
                return NULL;
        } else {
 #ifdef MS_WINDOWS
-               return Py_BuildValue("l", (long)
+               return PyInt_FromLong((long)
                                       FlushViewOfFile(self->data+offset, size));
 #endif /* MS_WINDOWS */
 #ifdef UNIX
@@ -505,7 +505,7 @@ mmap_flush_method(mmap_object *self, PyObject *args)
                        PyErr_SetFromErrno(mmap_module_error);
                        return NULL;
                }
-               return Py_BuildValue("l", (long) 0);
+               return PyInt_FromLong(0);
 #endif /* UNIX */
        }
 }
index 2fb16ebd0df497682c2f776cd965297b5d2afab4..6d2c648de52685d8c19187c32cf3b0f3ec2b7bb8 100644 (file)
@@ -1136,9 +1136,9 @@ instance_ass_item(PyInstanceObject *inst, Py_ssize_t i, PyObject *item)
        if (func == NULL)
                return -1;
        if (item == NULL)
-               arg = Py_BuildValue("i", i);
+               arg = PyInt_FromSsize_t(i);
        else
-               arg = Py_BuildValue("(iO)", i, item);
+               arg = Py_BuildValue("(nO)", i, item);
        if (arg == NULL) {
                Py_DECREF(func);
                return -1;
index a75c14e878636931528d07c1bbabca4bd3738ba7..59d39605d25802c252264981f495f33ee2f819eb 100644 (file)
@@ -112,7 +112,7 @@ get_counts(void)
        if (result == NULL)
                return NULL;
        for (tp = type_list; tp; tp = tp->tp_next) {
-               v = Py_BuildValue("(siii)", tp->tp_name, tp->tp_allocs,
+               v = Py_BuildValue("(snnn)", tp->tp_name, tp->tp_allocs,
                                  tp->tp_frees, tp->tp_maxalloc);
                if (v == NULL) {
                        Py_DECREF(result);