summaryrefslogtreecommitdiff
path: root/lang
diff options
context:
space:
mode:
authorMichael Cahill <michael.cahill@wiredtiger.com>2011-08-29 15:46:55 +1000
committerMichael Cahill <michael.cahill@wiredtiger.com>2011-08-29 15:46:55 +1000
commit45c9f74209c3e4a35267ce0f97334ac23e3b0c7b (patch)
treeb5275b577aec2ace459a244eb387038eb047107f /lang
parentf73c583809ea729340c2e7c28eeb38f6dcb1e52e (diff)
downloadmongo-45c9f74209c3e4a35267ce0f97334ac23e3b0c7b.tar.gz
Add some missing error checking to extension functions in the Python API.
Diffstat (limited to 'lang')
-rw-r--r--lang/python/wiredtiger.i18
1 files changed, 14 insertions, 4 deletions
diff --git a/lang/python/wiredtiger.i b/lang/python/wiredtiger.i
index 42e7a5b29f3..38cf470fa85 100644
--- a/lang/python/wiredtiger.i
+++ b/lang/python/wiredtiger.i
@@ -172,19 +172,29 @@ SELFHELPER(struct wt_cursor)
PyObject *_get_key() {
WT_ITEM k;
- $self->get_key($self, &k);
+ int ret = $self->get_key($self, &k);
+ if (ret != 0) {
+ PyErr_SetString(wtError, wiredtiger_strerror(ret));
+ return (NULL);
+ }
return SWIG_FromCharPtrAndSize(k.data, k.size);
}
uint64_t _get_recno() {
- uint64_t r;
- $self->get_key($self, &r);
+ uint64_t r = 0;
+ int ret = $self->get_key($self, &r);
+ if (ret != 0)
+ PyErr_SetString(wtError, wiredtiger_strerror(ret));
return r;
}
PyObject *_get_value() {
WT_ITEM v;
- $self->get_value($self, &v);
+ int ret = $self->get_value($self, &v);
+ if (ret != 0) {
+ PyErr_SetString(wtError, wiredtiger_strerror(ret));
+ return (NULL);
+ }
return SWIG_FromCharPtrAndSize(v.data, v.size);
}