Commit a9016c49 authored by Committed by Daniel Veillard
Fix a few problems with setEntityLoader
1. Setting entity loader does not increment the refcount on the Python object passed in. This works only if the object is not deleted. For example, the following code results in segmentation fault in Python interpreter when attempting to process any document: [[[ def register_entity_loader(): def entity_loader(URL, ID, ctxt): ... libxml2.setEntityLoader(entity_loader register_entity_loader() ]]] 2. setEntityLoader() does not verify if the passed object is callable. If it is not, current implementation attempts to call it anyway and failing that, silently moves on to default entity loader. Attached patch makes setEntityLoader raise ValueError exception if non-callable object is passed. 3. In debug mode, pythonExternalEntityLoader() outputs the result object to stderr, while the messages before and after the object (description + newline) go to stdout. Attached patch makes them all go to stdout.
Showing with 8 additions and 1 deletion