[issue16076] xml.etree.ElementTree.Element and xml.etree.ElementTree.TreeBuilder are no longer pickleable

Eli Bendersky report at bugs.python.org
Sun Dec 30 01:18:33 CET 2012


Eli Bendersky added the comment:

I think I understand what's going on there. Pickle, to make sure an object can be picked, looks at the module it comes from and tries to import its class, to make sure they're the same.

What happens since 3.3 is that for the Python Element class, it imports ElementTree. The harness in test_xml_etree carefully sets up to ignore _elementtree so the correct class is pulled. However, if test___all__ runs before it it just does a brute "from ElementTree import *" which places the C version in sys.modules, and this is what pickle finds.

So in the meantime, until issue 15083 is resolved I think it's safe to put ET in the ignore list of test___all__.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue16076>
_______________________________________


More information about the Python-bugs-list mailing list