python: Robust exception handling in callbacks.
authorJustus Winter <justus@gnupg.org>
Thu, 19 May 2016 09:03:27 +0000 (11:03 +0200)
committerJustus Winter <justus@gnupg.org>
Thu, 19 May 2016 13:58:45 +0000 (15:58 +0200)
commitd90857a08c4fe5b73b6d6d46fd6200efdd72db44
tree93ce7fab9855dfa66bf0d1f45cba4010d3eba1af
parent2f748b5a2d162be4f23b18782219771ead54cb51
python: Robust exception handling in callbacks.

* lang/python/helpers.c (pygpgme_stash_callback_exception): New
function.
(pygpgme_raise_callback_exception): Likewise.
(pyPassphraseCb): Stash python errors.
* lang/python/helpers.h (pygpgme_raise_callback_exception): New
prototype.
* lang/python/pyme/core.py ({Context,Data}.__init__): Move common
initialization to superclass.
(Context.set_progress_cb): Hand in 'self'.
* lang/python/pyme/util.py (GpgmeWrapper.__init__): New function.
(GpgmeWrapper.__getattr__): Raise stashed exceptions.
* lang/python/tests/Makefile.am (py_tests): Add new test.
* lang/python/tests/t-callbacks.py: New file.

Signed-off-by: Justus Winter <justus@gnupg.org>
lang/python/helpers.c
lang/python/helpers.h
lang/python/pyme/core.py
lang/python/pyme/util.py
lang/python/tests/Makefile.am
lang/python/tests/t-callbacks.py [new file with mode: 0755]