diff -up ldns-1.7.0/ldns-1.7.0/contrib/python/ldns_key.i.swig4 ldns-1.7.0/ldns-1.7.0/contrib/python/ldns_key.i
--- ldns-1.7.0/contrib/python/ldns_key.i.swig4	2016-12-20 11:48:22.000000000 +0100
+++ ldns-1.7.0/contrib/python/ldns_key.i	2019-03-15 12:21:22.608314831 +0100
@@ -41,7 +41,7 @@
   $result = SWIG_Python_AppendOutput($result, SWIG_NewPointerObj(SWIG_as_voidptr($1_key), SWIGTYPE_p_ldns_struct_key, SWIG_POINTER_OWN |  0 ));
 }
 
-%exception ldns_key_set_pubkey_owner(ldns_key *k, ldns_rdf *r)  %{ $action Py_INCREF(obj1); %}
+%typemap(argout) ldns_rdf *r "Py_INCREF($input);"
 
 %nodefaultctor ldns_struct_key; //no default constructor & destructor
 %nodefaultdtor ldns_struct_key;
