[Thuban-commits] r2807 - branches/WIP-pyshapelib-Unicode/thuban/libraries/pyshapelib

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Tue Jan 15 21:20:11 CET 2008


Author: bramz
Date: 2008-01-15 21:20:10 +0100 (Tue, 15 Jan 2008)
New Revision: 2807

Modified:
   branches/WIP-pyshapelib-Unicode/thuban/libraries/pyshapelib/ChangeLog
   branches/WIP-pyshapelib-Unicode/thuban/libraries/pyshapelib/shapelibmodule.c
Log:
In shapefile_write_object, use PyArg_ParseTuple to
check type of object instead of running our own test.

Modified: branches/WIP-pyshapelib-Unicode/thuban/libraries/pyshapelib/ChangeLog
===================================================================
--- branches/WIP-pyshapelib-Unicode/thuban/libraries/pyshapelib/ChangeLog	2008-01-11 17:39:52 UTC (rev 2806)
+++ branches/WIP-pyshapelib-Unicode/thuban/libraries/pyshapelib/ChangeLog	2008-01-15 20:20:10 UTC (rev 2807)
@@ -1,3 +1,8 @@
+2008-01-15  Bram de Greve <bram.degreve at bramz.net>
+
+	* shapelibmodule.c: In shapefile_write_object, use PyArg_ParseTuple to
+	check type of object instead of running our own test.
+
 2008-01-11  Bram de Greve <bram.degreve at bramz.net>
 
 	* dbflibmodule.c: dbfopen.c returns integers with width > 10 as FTDouble

Modified: branches/WIP-pyshapelib-Unicode/thuban/libraries/pyshapelib/shapelibmodule.c
===================================================================
--- branches/WIP-pyshapelib-Unicode/thuban/libraries/pyshapelib/shapelibmodule.c	2008-01-11 17:39:52 UTC (rev 2806)
+++ branches/WIP-pyshapelib-Unicode/thuban/libraries/pyshapelib/shapelibmodule.c	2008-01-15 20:20:10 UTC (rev 2807)
@@ -634,14 +634,8 @@
 	int index, result;
 	PyObject* object;
 	
-	if (!PyArg_ParseTuple(args, "iO:write_object", &index, &object)) return NULL;
+	if (!PyArg_ParseTuple(args, "iO!:write_object", &index, &SHPObjectType, &object)) return NULL;
 	
-	if (!PyObject_IsInstance(object, (PyObject*)&SHPObjectType))
-	{
-		PyErr_SetString(PyExc_TypeError, "object is not a SHPObject");
-		return NULL;
-	}
-	
 	result = SHPWriteObject(self->handle, index, ((SHPObjectObject*)object)->shpObject);
 	if (result < 0)
 	{



More information about the Thuban-commits mailing list