Emil Kroymann wrote:
sorry for the delay, but here is the patch. I have never used PyRex bevor, so I wonder if there are no memory leaks. I think the xmlOutputBuffer memory is freed correctly, though there is no explicit call to do this.
Thanks for the patch! I'll study the code to verify the memory issue.
Another thing is, that the encoding parameter given to ElementTree.write now uses the libxml2 encoding names rather than the Python encoding names. There could be differences.
I'm mostly concerned about making UTF-8 work, so I'll make sure it at least recognize those. I notice you didn't run the lxml tests correctly after applying the patch; the tests do a lot of work with StringIO and your check: if not tree.PyFile_Check(file): raise ValueError("Not a file!") breaks these tests. Feel free to help me to investigate how to handle the StringIO scenario correctly. :) Regards, Martijn