Home GnuPG
Diffusion GPGME f3618bc615e3

python: Rework callbacks.
f3618bc615e3Unpublished

Unpublished Commit ยท Learn More

Not On Permanent Ref: This commit is not an ancestor of any permanent ref.

Description

python: Rework callbacks.

Simplify how the lifetime of callback arguments is managed.

  • lang/python/gpgme.i (gpgme_edit_cb_t): Check arguments.

(PyObject_p_p, void_p_p): Drop rather dangerous interface.
(pygpgme_unwrap_gpgme_ctx_t): New function.

  • lang/python/helpers.c (pygpgme_clear_generic_cb): Drop dangerous

function.
(pyPassphraseCb): Assert contract.
(pygpgme_set_passphrase_cb): Use Python's calling convention so that
we can raise exceptions. Hand in 'self', get the wrapped object, and
simply store the hook data as attribute of the wrapper object.
(pyProgressCb, pygpgme_set_progress_cb): Likewise.
(pygpgme_set_status_cb): Likewise.
(pygpgme_data_new_from_cbs): Likewise.

  • lang/python/helpers.h (pygpgme_clear_generic_cb): Drop prototype.

(pygpgme_set_passphrase_cb): Update prototype.
(pygpgme_set_progress_cb): Likewise.
(pygpgme_set_status_cb): Likewise.
(pygpgme_data_new_from_cbs): Likewise.
(pygpgme_unwrap_gpgme_ctx_t): New prottotype.

  • lang/python/pyme/core.py (Context, Data): Update callsites.
  • Signed-off-by: Justus Winter <justus@g10code.com>

Details

Provenance
justusAuthored on Jun 13 2016, 7:16 PM
Parents
rM616929b6edf0: python: Wrap objects implementing the buffer protocol.
Branches
Unknown
Tags
Unknown

Event Timeline

Justus Winter <justus@g10code.com> committed rMf3618bc615e3: python: Rework callbacks. (authored by Justus Winter <justus@g10code.com>).Jun 16 2016, 2:19 PM