[Python-checkins] r46529 - in python/trunk: Modules/binascii.c Modules/mmapmodule.c Objects/classobject.c Objects/object.c

georg.brandl python-checkins at python.org
Mon May 29 21:39:46 CEST 2006


Author: georg.brandl
Date: Mon May 29 21:39:45 2006
New Revision: 46529

Modified:
   python/trunk/Modules/binascii.c
   python/trunk/Modules/mmapmodule.c
   python/trunk/Objects/classobject.c
   python/trunk/Objects/object.c
Log:
Correct some value converting strangenesses.



Modified: python/trunk/Modules/binascii.c
==============================================================================
--- python/trunk/Modules/binascii.c	(original)
+++ python/trunk/Modules/binascii.c	Mon May 29 21:39:45 2006
@@ -644,7 +644,7 @@
 
 	/* 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;

Modified: python/trunk/Modules/mmapmodule.c
==============================================================================
--- python/trunk/Modules/mmapmodule.c	(original)
+++ python/trunk/Modules/mmapmodule.c	Mon May 29 21:39:45 2006
@@ -477,7 +477,7 @@
 	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 @@
 		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 @@
 			PyErr_SetFromErrno(mmap_module_error);
 			return NULL;
 		}
-		return Py_BuildValue("l", (long) 0);
+		return PyInt_FromLong(0);
 #endif /* UNIX */
 	}
 }

Modified: python/trunk/Objects/classobject.c
==============================================================================
--- python/trunk/Objects/classobject.c	(original)
+++ python/trunk/Objects/classobject.c	Mon May 29 21:39:45 2006
@@ -1136,9 +1136,9 @@
 	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;

Modified: python/trunk/Objects/object.c
==============================================================================
--- python/trunk/Objects/object.c	(original)
+++ python/trunk/Objects/object.c	Mon May 29 21:39:45 2006
@@ -112,7 +112,7 @@
 	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);


More information about the Python-checkins mailing list