segmentation fault after unpickling html tree

Bug #567830 reported by Bodo Graumann
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
lxml
Fix Released
High
scoder

Bug Description

When running the sample code in the attachment, a segmentation fault occurs.
Even with the latest trunk version, unpickling is not succesfully possible.
When trying to use another pickle protocol version (0 or 1), an exception is thrown on pickling:
"TypeError: can't pickle ElementBase objects"

System: Gentoo Linux, libxml2 v2.7.7, libxslt v1.1.26, python v2.6.5

Revision history for this message
Bodo Graumann (mail-bodograumann) wrote :
Revision history for this message
scoder (scoder) wrote :

With the latest trunk, you'll get an AssertionError instead of a segfault.

Changed in lxml:
assignee: nobody → Stefan Behnel (scoder)
importance: Undecided → High
milestone: none → 2.3
status: New → Fix Committed
Revision history for this message
Bodo Graumann (mail-bodograumann) wrote :

So is there a way to have it pickle and unpickle correctly?

Revision history for this message
scoder (scoder) wrote :

No. This has been requested before, but due to the way pickle works, it's impossible to make sure you get the same type of Element proxies back that you put in. You'd get the same XML tree, but not necessarily the same interface to it.

Pickling is only supported for lxml.objectify, where the interface is fixed.

Revision history for this message
scoder (scoder) wrote :

Fixed in lxml 2.3alpha1.

Changed in lxml:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Bug attachments

Remote bug watches

Bug watches keep track of this bug in other bug trackers.