python: Make swig bindings python independent.
authorJosé Fonseca <jfonseca@vmware.com>
Thu, 26 Mar 2009 11:29:59 +0000 (11:29 +0000)
committerJosé Fonseca <jfonseca@vmware.com>
Thu, 26 Mar 2009 11:29:59 +0000 (11:29 +0000)
src/gallium/state_trackers/python/gallium.i
src/gallium/state_trackers/python/p_texture.i

index 8b43c1721ef3233d3339f0bd07b713f24aaef9f7..4970819190e988662393b3e543aaf982fce3e0b1 100644 (file)
@@ -37,7 +37,6 @@
 %{
 
 #include <stdio.h>
-#include <Python.h>
 
 #include "pipe/p_screen.h"
 #include "pipe/p_context.h"
@@ -58,7 +57,7 @@
 %}
 
 %include "typemaps.i"
-
+%include "exception.i"
 %include "cstring.i"
 
 %include "carrays.i"
index 63c63db9ebed2d0b9daf53beaa9752abb5638166..b03054adcced16c7ac09ab9f187b407637f6c431 100644 (file)
       
       assert(p_atomic_read(&$self->reference.count) > 0);
       
-      if(offset > $self->size) {
-         PyErr_SetString(PyExc_ValueError, "offset must be smaller than buffer size");
-         return;
-      }
+      if(offset > $self->size)
+         SWIG_exception(SWIG_ValueError, "offset must be smaller than buffer size");
 
-      if(offset + LENGTH > $self->size) {
-         PyErr_SetString(PyExc_ValueError, "data length must fit inside the buffer");
-         return;
-      }
+      if(offset + LENGTH > $self->size)
+         SWIG_exception(SWIG_ValueError, "data length must fit inside the buffer");
 
       pipe_buffer_write(screen, $self, offset, LENGTH, STRING);
+
+fail:
+      return;
    }
 };