From 2ae847c02731994d99e69d3d025ff01f41406452 Mon Sep 17 00:00:00 2001 From: Justus Winter Date: Fri, 27 May 2016 14:04:28 +0200 Subject: python: Implement data callbacks. * lang/python/gpgme.i (object_to_gpgme_t): Set exception on error. * lang/python/helpers.c (pyDataReadCb): New function. (pyDataWriteCb): Likewise. (pyDataSeekCb): Likewise. (pyDataReleaseCb): Likewise. (pygpgme_data_new_from_cbs): Likewise. * lang/python/helpers.h (pygpgme_data_new_from_cbs): New prototype. * lang/python/pyme/core.py (Data.__init__): Fix docstring, fix read callbacks. (Data.__del__): Fix read callbacks. (Data._free_readcb): Drop function. (Data._free_datacbs): New function. (Data.new_from_cbs): Fix setting the callbacks. (Data.write): Raise stashed exceptions. (Data.read): Likewise. * lang/python/tests/t-callbacks.py: Test new functionality. * lang/python/tests/t-data.py: Likewise. Signed-off-by: Justus Winter --- lang/python/helpers.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lang/python/helpers.h') diff --git a/lang/python/helpers.h b/lang/python/helpers.h index 5dd88a06..8b900085 100644 --- a/lang/python/helpers.h +++ b/lang/python/helpers.h @@ -40,3 +40,7 @@ void pygpgme_set_status_cb(gpgme_ctx_t ctx, PyObject *cb, gpgme_error_t pyEditCb(void *opaque, gpgme_status_code_t status, const char *args, int fd); + +gpgme_error_t pygpgme_data_new_from_cbs(gpgme_data_t *r_data, + PyObject *pycbs, + PyObject **freelater); -- cgit v1.2.3