aboutsummaryrefslogtreecommitdiffhomepage
path: root/bindings
diff options
context:
space:
mode:
authorGravatar Thomas Jost <schnouki@schnouki.net>2011-12-06 11:03:22 +0100
committerGravatar Sebastian Spaeth <Sebastian@SSpaeth.de>2011-12-06 13:34:30 +0100
commit71e0082eff05f52709500109f1a194fdb03571e5 (patch)
tree9dddd422aae01d34f84f3e7f6705e1bc337311df /bindings
parent672b6337b4adc5dda6070210ab30895075f7cf21 (diff)
python: use wrapped notmuch_*_t types instead of raw pointers
Now that types are checked correctly, we also need to make sure that all the arguments actually are instances of these types. Otherwise the function calls will fail and raise an exception similar to this one: ctypes.ArgumentError: argument 3: <type 'exceptions.TypeError'>: expected LP_LP_NotmuchMessageS instance instead of pointer to c_void_p
Diffstat (limited to 'bindings')
-rw-r--r--bindings/python/notmuch/database.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/bindings/python/notmuch/database.py b/bindings/python/notmuch/database.py
index 471adaa5..5b1b00bd 100644
--- a/bindings/python/notmuch/database.py
+++ b/bindings/python/notmuch/database.py
@@ -79,6 +79,7 @@ class Database(object):
_open = nmlib.notmuch_database_open
_open.argtypes = [c_char_p, c_uint]
_open.restype = NotmuchDatabaseP
+ #_open.restype = c_void_p
"""notmuch_database_upgrade"""
_upgrade = nmlib.notmuch_database_upgrade
@@ -385,7 +386,7 @@ class Database(object):
be added.
"""
self._assert_db_is_initialized()
- msg_p = c_void_p()
+ msg_p = NotmuchMessageP()
status = self._add_message(self._db, _str(filename), byref(msg_p))
if not status in [STATUS.SUCCESS, STATUS.DUPLICATE_MESSAGE_ID]:
@@ -453,7 +454,7 @@ class Database(object):
the database was not intitialized.
"""
self._assert_db_is_initialized()
- msg_p = c_void_p()
+ msg_p = NotmuchMessageP()
status = Database._find_message(self._db, _str(msgid), byref(msg_p))
if status != STATUS.SUCCESS:
raise NotmuchError(status)
@@ -487,7 +488,7 @@ class Database(object):
*Added in notmuch 0.9*"""
self._assert_db_is_initialized()
- msg_p = c_void_p()
+ msg_p = NotmuchMessageP()
status = Database._find_message_by_filename(self._db, _str(filename),
byref(msg_p))
if status != STATUS.SUCCESS: