Message178776
| Author |
danielsh |
| Recipients |
Arfrever, danielsh, einarfd, eli.bendersky, ezio.melotti, flox, georg.brandl, jcea, larry, python-dev, santoso.wijaya, skrah |
| Date |
2013年01月01日.22:56:48 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<20130101225642.GB3402@lp-shahaf.local> |
| In-reply-to |
<1357055639.81.0.739252265035.issue16076@psf.upfronthosting.co.za> |
| Content |
Eli Bendersky wrote on Tue, Jan 01, 2013 at 15:54:00 +0000:
> Why did you change the class name, by the way, I don't think it's
> a valid change at least for 3.3 in terms of backwards compatibility.
>
With unmodified tip of 3.4:
>>> import pickle, xml.etree.ElementTree as ET
>>> pickle.dumps(ET.Element('foo'))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
_pickle.PicklingError: Can't pickle <class 'Element'>: attribute lookup builtins.Element failed
I added the "_elementtree" to the tp_name in order to bypass the above
error. Module-qualified names were in use elsewhere (including by
_elementtree._element_iterator) so it seemed reasonable. I'll defer to
you about compatibility implications of this change.
> Regarding that compatibility, and even easier idea would be for the
> C pickle to return the same __dict__ implicitly gathered from the
> Python version, and then only one version of the unpickle is required.
That makes sense. But going forward it might be even better to define
an explicit __reduce__/__getstate__ for the Python version too, so if
the instance dict grows new members, they won't get serialised
unintentionally. (This consideration is also why C code in the latest
patch makes some effort to notice unknown args in the dict.) |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2013年01月01日 22:56:48 | danielsh | set | recipients:
+ danielsh, georg.brandl, jcea, larry, ezio.melotti, Arfrever, eli.bendersky, skrah, flox, santoso.wijaya, python-dev, einarfd |
| 2013年01月01日 22:56:48 | danielsh | link | issue16076 messages |
| 2013年01月01日 22:56:48 | danielsh | create |
|