[issue34894] Unexpected error while unpickling lxml.etree.Element object

Marcin Raczyński report at bugs.python.org
Thu Oct 4 11:13:53 EDT 2018


New submission from Marcin Raczyński <niejako at gmail.com>:

If we use pickle.HIGHEST_PROTOCOL we can pickle lxml.etree.Element object but unpickling give us misleading error description:

>>> from lxml import etree
>>> import pickle
>>> import sys
sys.version
'2.7.15rc1 (default, Apr 15 2018, 21:51:34) \n[GCC 7.3.0]'
>>> etree.__version__
u'4.2.5'
>>> pickled = pickle.dumps(etree.Element('x'), protocol=pickle.HIGHEST_PROTOCOL)
>>> pickle.loads(pickled)
Traceback (most recent call last):
  File "<input>", line 1, in <module>
    pickle.loads(pickled)
  File "src/lxml/etree.pyx", line 1131, in lxml.etree._Element.__repr__
  File "src/lxml/etree.pyx", line 981, in lxml.etree._Element.tag.__get__
  File "src/lxml/apihelpers.pxi", line 19, in lxml.etree._assertValidNode
AssertionError: invalid Element proxy at 140260172089392


See also: https://bugs.launchpad.net/lxml/+bug/736708

----------
components: Library (Lib)
messages: 327054
nosy: marc1nr
priority: normal
severity: normal
status: open
title: Unexpected error while unpickling lxml.etree.Element object
type: behavior
versions: Python 2.7

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue34894>
_______________________________________


More information about the Python-bugs-list mailing list