summaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers/python
diff options
context:
space:
mode:
authorJosé Fonseca <[email protected]>2009-03-26 11:29:59 +0000
committerJosé Fonseca <[email protected]>2009-03-26 11:29:59 +0000
commitbb84ce71593d79bae9e8a5a8bdd4b2bd6aba2c87 (patch)
tree1fe4b355cff1101944dd53fc4bcbcafd6de447a1 /src/gallium/state_trackers/python
parentd18c2ee3d5a1d0352a6f8d48aa067e8983dd5878 (diff)
python: Make swig bindings python independent.
Diffstat (limited to 'src/gallium/state_trackers/python')
-rw-r--r--src/gallium/state_trackers/python/gallium.i3
-rw-r--r--src/gallium/state_trackers/python/p_texture.i15
2 files changed, 8 insertions, 10 deletions
diff --git a/src/gallium/state_trackers/python/gallium.i b/src/gallium/state_trackers/python/gallium.i
index 8b43c1721ef..4970819190e 100644
--- a/src/gallium/state_trackers/python/gallium.i
+++ b/src/gallium/state_trackers/python/gallium.i
@@ -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"
diff --git a/src/gallium/state_trackers/python/p_texture.i b/src/gallium/state_trackers/python/p_texture.i
index 63c63db9ebe..b03054adcce 100644
--- a/src/gallium/state_trackers/python/p_texture.i
+++ b/src/gallium/state_trackers/python/p_texture.i
@@ -347,16 +347,15 @@
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;
}
};