gpgme -- How should gpgme_release be used?

andres at andres at
Sat May 5 01:07:01 CEST 2001


I'm wrapping gpgme with some Python classes and I have created a "Context"
class to shadow the GpgmeCtx data structure.

I can initialize a new context easily with gpgme_new, but when I call
gpgme_release immediately on the same context I get this error:

python: key.c:130: gpgme_key_release: Assertion key->ref_count' failed.  

Is there some further initialization I need to do on a context before I can
safely release it? Do I understand properly the use of gpgme_release?

My code goes something like this:

class Context:

    def __init__(self):
        self.context = gpgme.new_context() # method added by myself to get
	                                   # a GpgmeCtx pointer
	gpgme.gpgme_new( self.context )
    def __del__(self):
# Test the code
context = Context()
del context
Andres Corrada-Emmanuel   Email: andres at

More information about the Gnupg-devel mailing list