[Python-checkins] python/dist/src/Mac/Modules/list _Listmodule.c, 1.18, 1.19

jackjansen@users.sourceforge.net jackjansen at users.sourceforge.net
Sun Jul 3 23:00:13 CEST 2005


Update of /cvsroot/python/python/dist/src/Mac/Modules/list
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25508/list

Modified Files:
	_Listmodule.c 
Log Message:
Updated (and regenerated) for name change in tp_init method arguments:
they are now _self, _args and _kwds.


Index: _Listmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Mac/Modules/list/_Listmodule.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- _Listmodule.c	20 Nov 2003 13:30:58 -0000	1.18
+++ _Listmodule.c	3 Jul 2005 20:59:40 -0000	1.19
@@ -50,9 +50,9 @@
 {
 	ListObject *it;
 	if (itself == NULL) {
-						PyErr_SetString(List_Error,"Cannot create null List");
-						return NULL;
-					}
+	                                PyErr_SetString(List_Error,"Cannot create null List");
+	                                return NULL;
+	                        }
 	it = PyObject_NEW(ListObject, &List_Type);
 	if (it == NULL) return NULL;
 	it->ob_itself = itself;
@@ -61,6 +61,7 @@
 	SetListRefCon(itself, (long)it);
 	return (PyObject *)it;
 }
+
 int ListObj_Convert(PyObject *v, ListHandle *p_itself)
 {
 	if (!ListObj_Check(v))
@@ -738,16 +739,16 @@
 
 #define ListObj_tp_alloc PyType_GenericAlloc
 
-static PyObject *ListObj_tp_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
+static PyObject *ListObj_tp_new(PyTypeObject *type, PyObject *_args, PyObject *_kwds)
 {
-	PyObject *self;
+	PyObject *_self;
 	ListHandle itself;
 	char *kw[] = {"itself", 0};
 
-	if (!PyArg_ParseTupleAndKeywords(args, kwds, "O&", kw, ListObj_Convert, &itself)) return NULL;
-	if ((self = type->tp_alloc(type, 0)) == NULL) return NULL;
-	((ListObject *)self)->ob_itself = itself;
-	return self;
+	if (!PyArg_ParseTupleAndKeywords(_args, _kwds, "O&", kw, ListObj_Convert, &itself)) return NULL;
+	if ((_self = type->tp_alloc(type, 0)) == NULL) return NULL;
+	((ListObject *)_self)->ob_itself = itself;
+	return _self;
 }
 
 #define ListObj_tp_free PyObject_Del
@@ -826,10 +827,10 @@
 	                      &hasGrow,
 	                      &scrollHoriz,
 	                      &scrollVert))
-		return NULL;
+	        return NULL;
 
 
-	/* Carbon applications use the CreateCustomList API */ 
+	/* Carbon applications use the CreateCustomList API */
 	theSpec.u.userProc = myListDefFunctionUPP;
 	CreateCustomList(&rView,
 	                 &dataBounds,
@@ -845,7 +846,7 @@
 
 	_res = ListObj_New(outList);
 	if (_res == NULL)
-		return NULL;
+	        return NULL;
 	Py_INCREF(listDefFunc);
 	((ListObject*)_res)->ob_ldef_func = listDefFunc;
 	return _res;
@@ -1024,7 +1025,7 @@
 	Handle h;
 	ListObject *l;
 	if (!PyArg_ParseTuple(_args, "O&", ResObj_Convert, &h))
-		return NULL;
+	        return NULL;
 	l = (ListObject *)ListObj_New(as_List(h));
 	l->ob_must_be_disposed = 0;
 	_res = Py_BuildValue("O", l);
@@ -1066,34 +1067,34 @@
                        Cell theCell,
                        SInt16 dataOffset,
                        SInt16 dataLen,
-                       ListHandle theList)  
+                       ListHandle theList)
 {
-	PyObject *listDefFunc, *args, *rv=NULL;
-	ListObject *self;
-	
-	self = (ListObject*)GetListRefCon(theList);
-	if (self == NULL || self->ob_itself != theList)
-		return;  /* nothing we can do */
-	listDefFunc = self->ob_ldef_func;
-	if (listDefFunc == NULL)
-		return;  /* nothing we can do */
-	args = Py_BuildValue("hbO&O&hhO", message,
-	                                  selected,
-	                                  PyMac_BuildRect, cellRect,
-	                                  PyMac_BuildPoint, theCell,
-	                                  dataOffset,
-	                                  dataLen,
-	                                  self);
-	if (args != NULL) {
-		rv = PyEval_CallObject(listDefFunc, args);
-		Py_DECREF(args);
-	}
-	if (rv == NULL) {
-		PySys_WriteStderr("error in list definition callback:\n");
-		PyErr_Print();
-	} else {
-		Py_DECREF(rv);
-	}
+        PyObject *listDefFunc, *args, *rv=NULL;
+        ListObject *self;
+
+        self = (ListObject*)GetListRefCon(theList);
+        if (self == NULL || self->ob_itself != theList)
+                return;  /* nothing we can do */
+        listDefFunc = self->ob_ldef_func;
+        if (listDefFunc == NULL)
+                return;  /* nothing we can do */
+        args = Py_BuildValue("hbO&O&hhO", message,
+                                          selected,
+                                          PyMac_BuildRect, cellRect,
+                                          PyMac_BuildPoint, theCell,
+                                          dataOffset,
+                                          dataLen,
+                                          self);
+        if (args != NULL) {
+                rv = PyEval_CallObject(listDefFunc, args);
+                Py_DECREF(args);
+        }
+        if (rv == NULL) {
+                PySys_WriteStderr("error in list definition callback:\n");
+                PyErr_Print();
+        } else {
+                Py_DECREF(rv);
+        }
 }
 
 



More information about the Python-checkins mailing list