Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _destroy_dc_context(dc_context, dc_context_unref=lib.dc_context_unref):
# destructor for dc_context
dc_context_unref(dc_context)
try:
deltachat.clear_context_callback(dc_context)
except (TypeError, AttributeError):
# we are deep into Python Interpreter shutdown,
# so no need to clear the callback context mapping.
pass