[MOAB-dev] r3161 - MOAB/branches/python/tools/iMesh/python

jvporter at wisc.edu jvporter at wisc.edu
Tue Sep 22 16:13:48 CDT 2009


Author: jvporter
Date: 2009-09-22 16:13:48 -0500 (Tue, 22 Sep 2009)
New Revision: 3161

Modified:
   MOAB/branches/python/tools/iMesh/python/common.h
   MOAB/branches/python/tools/iMesh/python/iBase.c
   MOAB/branches/python/tools/iMesh/python/iMesh.c
   MOAB/branches/python/tools/iMesh/python/iMesh_entSet.inl
   MOAB/branches/python/tools/iMesh/python/iMesh_tag.inl
Log:
More cleanup running parallel to adding iGeom


Modified: MOAB/branches/python/tools/iMesh/python/common.h
===================================================================
--- MOAB/branches/python/tools/iMesh/python/common.h	2009-09-22 19:24:46 UTC (rev 3160)
+++ MOAB/branches/python/tools/iMesh/python/common.h	2009-09-22 21:13:48 UTC (rev 3161)
@@ -38,7 +38,7 @@
 
 #define ADD_ENUM(typename,name,value)                           \
     do {                                                        \
-        PyObject *o = Py_BuildValue("i",(value));               \
+        PyObject *o = PyInt_FromLong((value));                  \
         PyDict_SetItemString((&typename ## _Type)->             \
                              tp_dict,(name),o);                 \
         Py_DECREF(o);                                           \

Modified: MOAB/branches/python/tools/iMesh/python/iBase.c
===================================================================
--- MOAB/branches/python/tools/iMesh/python/iBase.c	2009-09-22 19:24:46 UTC (rev 3160)
+++ MOAB/branches/python/tools/iMesh/python/iBase.c	2009-09-22 21:13:48 UTC (rev 3161)
@@ -78,9 +78,7 @@
 static PyObject *
 iBaseEntObj_repr(iBaseEntity_Object *self)
 {
-    char out[64];
-    snprintf(out,64,"<itaps.iBase.Entity %p>",self->handle);
-    return Py_BuildValue("s",out);
+    return PyString_FromFormat("<itaps.iBase.Entity %p>",self->handle);
 }
 
 static PyObject *
@@ -148,9 +146,7 @@
 static PyObject *
 iBaseEntSetObj_repr(iBaseEntitySet_Object *self)
 {
-    char out[64];
-    snprintf(out,64,"<itaps.iBase.EntitySet %p>",self->handle);
-    return Py_BuildValue("s",out);
+    return PyString_FromFormat("<itaps.iBase.EntitySet %p>",self->handle);
 }
 
 static PyObject *

Modified: MOAB/branches/python/tools/iMesh/python/iMesh.c
===================================================================
--- MOAB/branches/python/tools/iMesh/python/iMesh.c	2009-09-22 19:24:46 UTC (rev 3160)
+++ MOAB/branches/python/tools/iMesh/python/iMesh.c	2009-09-22 21:13:48 UTC (rev 3161)
@@ -131,7 +131,7 @@
     if(checkError(self->handle,err))
         return NULL;
 
-    return Py_BuildValue("i",order);
+    return PyInt_FromLong(order);
 }
 
 static PyObject *
@@ -159,7 +159,7 @@
     if(checkError(self->handle,err))
         return NULL;
 
-    return Py_BuildValue("i",areInv);
+    return PyInt_FromLong(areInv);
 }
 
 static PyObject *

Modified: MOAB/branches/python/tools/iMesh/python/iMesh_entSet.inl
===================================================================
--- MOAB/branches/python/tools/iMesh/python/iMesh_entSet.inl	2009-09-22 19:24:46 UTC (rev 3160)
+++ MOAB/branches/python/tools/iMesh/python/iMesh_entSet.inl	2009-09-22 21:13:48 UTC (rev 3161)
@@ -56,7 +56,7 @@
     if(checkError(self->instance->handle,err))
         return NULL;
 
-    return Py_BuildValue("i",num);
+    return PyInt_FromLong(num);
 }
 
 static PyObject *
@@ -71,7 +71,7 @@
     if(checkError(self->instance->handle,err))
         return NULL;
 
-    return Py_BuildValue("i",num);
+    return PyInt_FromLong(num);
 }
 
 static PyObject *
@@ -159,7 +159,7 @@
     if(checkError(self->instance->handle,err))
         return NULL;
 
-    return Py_BuildValue("i",num_sets);
+    return PyInt_FromLong(num_sets);
 }
 
 static PyObject *
@@ -386,7 +386,7 @@
     if(checkError(self->instance->handle,err))
         return NULL;
 
-    return Py_BuildValue("i",num_children);
+    return PyInt_FromLong(num_children);
 }
 
 static PyObject *
@@ -402,7 +402,7 @@
     if(checkError(self->instance->handle,err))
         return NULL;
 
-    return Py_BuildValue("i",num_parents);
+    return PyInt_FromLong(num_parents);
 }
 
 static PyObject *

Modified: MOAB/branches/python/tools/iMesh/python/iMesh_tag.inl
===================================================================
--- MOAB/branches/python/tools/iMesh/python/iMesh_tag.inl	2009-09-22 19:24:46 UTC (rev 3160)
+++ MOAB/branches/python/tools/iMesh/python/iMesh_tag.inl	2009-09-22 21:13:48 UTC (rev 3161)
@@ -41,7 +41,7 @@
     if(checkError(self->instance->handle,err))
         return NULL;
 
-    return Py_BuildValue("s",name);
+    return PyString_FromString(name);
 }
 
 static PyObject *
@@ -52,7 +52,7 @@
     if(checkError(self->instance->handle,err))
         return NULL;
 
-    return Py_BuildValue("i",size);
+    return PyInt_FromLong(size);
 }
 
 static PyObject *
@@ -63,7 +63,7 @@
     if(checkError(self->instance->handle,err))
         return NULL;
 
-    return Py_BuildValue("i",size);
+    return PyInt_FromLong(size);
 }
 
 static PyObject *
@@ -366,7 +366,7 @@
                                    self->base.handle,&data,&err);
             if(checkError(self->instance->handle,err))
                 return NULL;
-            return Py_BuildValue("i",data);
+            return PyInt_FromLong(data);
         }
         else if(type == iBase_DOUBLE)
         {
@@ -375,7 +375,7 @@
                                    self->base.handle,&data,&err);
             if(checkError(self->instance->handle,err))
                 return NULL;
-            return Py_BuildValue("d",data);
+            return PyFloat_FromDouble(data);
         }
         else if(type == iBase_ENTITY_HANDLE)
         {
@@ -412,7 +412,7 @@
                              &data,&err);
             if(checkError(self->instance->handle,err))
                 return NULL;
-            return Py_BuildValue("i",data);
+            return PyInt_FromLong(data);
         }
         else if(type == iBase_DOUBLE)
         {
@@ -421,7 +421,7 @@
                              &data,&err);
             if(checkError(self->instance->handle,err))
                 return NULL;
-            return Py_BuildValue("d",data);
+            return PyFloat_FromDouble(data);
         }
         else if(type == iBase_ENTITY_HANDLE)
         {



More information about the moab-dev mailing list