python: Make result objects more robust.
authorJustus Winter <justus@g10code.com>
Tue, 14 Jun 2016 15:33:12 +0000 (17:33 +0200)
committerJustus Winter <justus@g10code.com>
Thu, 16 Jun 2016 12:19:17 +0000 (14:19 +0200)
commita324d0cffe93cab955698c2c065b2f2227e379e4
tree81d04341068c2541f6fb77c31b7dc3303e2899bd
parent856bcfe2934237011984fab0bc69800a7c25c34b
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 <justus@g10code.com>
lang/python/gpgme.i
lang/python/helpers.c
lang/python/helpers.h
lang/python/pyme/results.py [new file with mode: 0644]