diff options
author | Ken Hughes <khughes@pacific.edu> | 2005-10-30 17:34:48 +0300 |
---|---|---|
committer | Ken Hughes <khughes@pacific.edu> | 2005-10-30 17:34:48 +0300 |
commit | 4d2de0293e579e6e2849d43f1d36efb1aae98110 (patch) | |
tree | 5e57451aaf32161d1048b1532b20f7222bb56bf7 /source/blender/python/api2_2x/NMesh.c | |
parent | ea8b08c2cc13c035eb13b72d6443f972e81bd66e (diff) |
-- fix compiler warning about return "from incompatible pointer type" when
returning Python exceptions. EXPP_ReturnPyObjError() always returns a
NULL because Python expects error conditions to return a NULL pointer
instead of an object. Since the pointer is cast to a PyObject *, it's
ugly to use for propagating the errors back in this case, so this fix just
uses PyErr_SetString() to set the error and return NULL (see the body
of EXPP_ReturnPyObjError() ).
Diffstat (limited to 'source/blender/python/api2_2x/NMesh.c')
-rw-r--r-- | source/blender/python/api2_2x/NMesh.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/source/blender/python/api2_2x/NMesh.c b/source/blender/python/api2_2x/NMesh.c index bef6e58d8a2..622536405ec 100644 --- a/source/blender/python/api2_2x/NMesh.c +++ b/source/blender/python/api2_2x/NMesh.c @@ -1465,16 +1465,20 @@ Mesh *Mesh_fromNMesh( BPy_NMesh * nmesh , int store_edges ) mesh = add_mesh( ); - if( !mesh ) - return EXPP_ReturnPyObjError( PyExc_RuntimeError, - "FATAL: could not create mesh object" ); + if( !mesh ) { + PyErr_SetString( PyExc_RuntimeError, + "FATAL: could not create mesh object" ); + return NULL; + } mesh->id.us = 0; /* no user yet */ G.totmesh++; - if( !convert_NMeshToMesh( mesh, nmesh, store_edges ) ) - return EXPP_ReturnPyObjError( PyExc_RuntimeError, + if( !convert_NMeshToMesh( mesh, nmesh, store_edges ) ) { + PyErr_SetString( PyExc_RuntimeError, "faces must have at 3 or 4 vertices" ); + return NULL; + } return mesh; } @@ -3413,8 +3417,9 @@ Mesh *NMesh_FromPyObject( PyObject * pyobj, Object * ob ) return mesh; } - return EXPP_ReturnPyObjError( PyExc_AttributeError, + PyErr_SetString( PyExc_AttributeError, "link argument type is not supported " ); + return NULL; } #define POINTER_CROSS_EQ(a1, a2, b1, b2) (((a1)==(b1) && (a2)==(b2)) || ((a1)==(b2) && (a2)==(b1))) |