This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author danielsh
Recipients Arfrever, danielsh, einarfd, eli.bendersky, ezio.melotti, flox, georg.brandl, jcea, larry, python-dev, santoso.wijaya, skrah
Date 2013-01-07.04:58:08
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1357534689.15.0.312196339878.issue16076@psf.upfronthosting.co.za>
In-reply-to
Content
Eli Bendersky wrote on Thu, Jan 03, 2013 at 14:44:02 +0000:
> If this change is required (even if we choose to name it
> "xml.etree.ElementTree.Element" for Py compatibility to fix the pickling
> regression, we may find ourselves in a need to change it between 3.3 and
> 3.3.1 and I'm not sure if that's valid. I hope my question on pydev will be
> resolved conclusively.
> 
> Danial, could you investigate if such a change is absolutely required to
> make pickling/unickling of Element work?

There are a few options:

- Change c-Element's tp_name to "xml.etree.ElementTree.Element".

- Register a reduce function for c-Element's that serialises them by
  constructing an equivalent py-Element and returning the latter's
  .__dict__ via the third return value:
  http://docs.python.org/3/library/copyreg#copyreg.pickle

- Add an entry mapping "builtins.Element" to
  "xml.etree.ElementTree.Element" to _compat_pickle.IMPORT_MAPPING
  (which is used by Lib/pickle.py:_Pickler.find_class()).

I haven't tried to implement either of these approaches.
History
Date User Action Args
2013-01-07 04:58:09danielshsetrecipients: + danielsh, georg.brandl, jcea, larry, ezio.melotti, Arfrever, eli.bendersky, skrah, flox, santoso.wijaya, python-dev, einarfd
2013-01-07 04:58:09danielshsetmessageid: <1357534689.15.0.312196339878.issue16076@psf.upfronthosting.co.za>
2013-01-07 04:58:09danielshlinkissue16076 messages
2013-01-07 04:58:08danielshcreate