[lxml-dev] Possible 'freeing null pointer' problem with 'document()' function

Sidnei da Silva sidnei at enfoldsystems.com
Thu Aug 23 15:49:52 CEST 2007


On 8/23/07, Stefan Behnel <stefan_ml at behnel.de> wrote:
>
> Sidnei da Silva wrote:
> > I wrote a script that performs the same transformation outside of
> > Apache, and surprisingly it works just fine. The only difference being
> > that the script resolves to a file in the filesystem, and the filter
> > in Apache uses urlopen().
>
> Hmm, are you passing the file name straight into etree in the script? Because
> the code for parsing from a file-like object is very different from the code
> that parses from a filename.
>
> You're using Python resolvers?

Yes, sorry. Let me be more explicit.

Both the script and the Apache filter are using urlopen() in a Python
resolver. The only difference is that the filter is passing http://
urls into the Python resolver -> urlopen(), and the script is passing
file:// urls into the Python resolver -> urlopen().

urlopen() then returns a file-like object, but I'm reading that into a
StringIO object which is then returned with resolve_file().

-- 
Sidnei da Silva
Enfold Systems                http://enfoldsystems.com
Fax +1 832 201 8856     Office +1 713 942 2377 Ext 214


More information about the lxml-dev mailing list