[ldns-users] pyLDNS fixes in ldns_buffer, ldns_rdf, ldns_dname and others

Willem Toorop willem at nlnetlabs.nl
Tue Aug 21 09:22:40 UTC 2012


Hi Karel,

Thanks again for your contributions! They are in revision 3710.
Maybe it would be nice to have the description of your fixes and
improvements in trunk/contrib/python/Changelog ?

Cheers,

-- Willem

Op 31-07-12 14:46, Karel Slany schreef:
> Hello,
> 
> I've written three scripts testing the functionality of ldns_buffer,
> ldns_rdf and ldns_dname Python classes. By running the scripts I've
> encountered several problems which have been fixed in the attached
> patch. The patch also contains the mentioned testing scripts, which need
> to be added into the repository in order to prevent breaking the
> functionality by code changes in future. So please don't forget to:
> 
> svn add trunk/contrib/python/examples/test_*.py
> chmod +x trunk/contrib/python/examples/test_*.py
> 
> Description of the fixed issues follows.
> 
> Python 3 related:
> * Fixed automatic conversion from string to ldns_rdf and ldns_dname.
> Caused memory corruption when using Python 3. The #ifdef
> SWIG_Python_str_AsChar does not actually work as SWIG_Python_str_AsChar
> is a function (at least in SWIG 2.0.4), so it has been replaced. Also in
> Python 3 the conversion would have caused memory leaks if it was working.
> * In Python 3 the wrapper now raises TypeError instead of ValueError
> when receiving a non FILE * argument when it should receive a FILE *
> argument. In Python 2 it raises TypeError by default, so it was changed
> to comply with Python 2.
> 
> Python serious issues:
> * Fixed wrong handling of _ldns_rr_list_free() and
> _ldns_rr_list_deep_free() when compiling with LDNS_DEBUG directive.
> * Fixed malfunctioning ldns.ldns_rdf_new_frm_fp_l().
> * Fixed malfunctioning ldns_drf.absolute() and ldns_dname.absolute()
> * Marked several functions related to ldns_rdf and ldns_buffer as
> returning new objects. It could lead to memory leaks, when not marked.
> (ldns_rdf.address_reverse(), ldns_rdf.cat_clone(), etc.)
> * And many small fixes preventing code crashes in ldns_buffer, ldns_rdf
> and ldns_dname.
> 
> Interface fixes and additions:
> * Method operating on ldns_dnames and returning dname ldns_rdfs now
> return ldns_dname instances. (This represents no compatibility issues,
> as ldns_dname is derived from ldns_rdf.)
> * Improved documentation of ldns_buffer, ldns_rdf and ldns_dname classes.
> * Methods ldns_buffer.available() and ldns_buffer.available_at() now
> return bool types as described in the documentation.
> * Added scripts for testing of basic functionality of the classes
> ldns_buffer, ldns_rdf, ldns_dname.
> * Added deprecation warnings to ldns_rdf methods operating on dname
> rdfs. The user is encouraged to converts dname ldns_rdfs to ldns_dnames.
> This saves several lines of sanity checking code in future.
> * Extended ldns_dname constructor to accept ldns_rdfs containing dnames.
> 
> I've tested the changes using Python 2.7 and 3.2. The changes maintain
> backward compatibility. However, in several cases the code will now
> throw a deprecation warning about changes of the interface in future.
> 
> Best regards,
> K.
> 
> 
> 
> _______________________________________________
> ldns-users mailing list
> ldns-users at open.nlnetlabs.nl
> http://open.nlnetlabs.nl/mailman/listinfo/ldns-users
> 




More information about the ldns-users mailing list