diff options
author | Justus Winter <[email protected]> | 2016-06-14 15:33:12 +0000 |
---|---|---|
committer | Justus Winter <[email protected]> | 2016-06-16 12:19:17 +0000 |
commit | a324d0cffe93cab955698c2c065b2f2227e379e4 (patch) | |
tree | 81d04341068c2541f6fb77c31b7dc3303e2899bd /lang/python/helpers.h | |
parent | python: Avoid creating SWIG proxy classes. (diff) | |
download | gpgme-a324d0cffe93cab955698c2c065b2f2227e379e4.tar.gz gpgme-a324d0cffe93cab955698c2c065b2f2227e379e4.zip |
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 <[email protected]>
Diffstat (limited to '')
-rw-r--r-- | lang/python/helpers.h | 2 |
1 files changed, 2 insertions, 0 deletions
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); |