From a324d0cffe93cab955698c2c065b2f2227e379e4 Mon Sep 17 00:00:00 2001 From: Justus Winter Date: Tue, 14 Jun 2016 17:33:12 +0200 Subject: python: Make result objects more robust. Results returned by the GPGME are fragile, i.e. they are only valid until the next operation is performed in the context. We cannot arbitrarily constrain the lifetime of Python objects, we therefore create deep copies of the results. * lang/python/gpgme.i (gpgme_tofu_info_t): Turn these into a list. (gpgme_*_result_t): Create deep copies of these objects. * lang/python/helpers.c (pygpgme_wrap_fragile_result): New function. * lang/python/helpers.h (pygpgme_wrap_fragile_result): New prototype. * lang/python/pyme/results.py: New file. Signed-off-by: Justus Winter --- lang/python/helpers.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lang/python/helpers.h') diff --git a/lang/python/helpers.h b/lang/python/helpers.h index 15642903..beb2682f 100644 --- a/lang/python/helpers.h +++ b/lang/python/helpers.h @@ -34,6 +34,8 @@ PyObject *object_to_gpgme_data_t(PyObject *input, int argnum, gpgme_data_t *wrapper, PyObject **bytesio, Py_buffer *view); +PyObject *pygpgme_wrap_fragile_result(PyObject *fragile, const char *classname); + PyObject *pygpgme_raise_callback_exception(PyObject *self); PyObject *pygpgme_set_passphrase_cb(PyObject *self, PyObject *cb); -- cgit v1.2.3