Eli Bendersky added the comment: On Tue, Jan 1, 2013 at 2:56 PM, Daniel Shahaf <rep...@bugs.python.org>wrote:
> > Daniel Shahaf added the comment: > > 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. I asked on pydev, but this is a key point to resolve. Can pickling/unpickling be made to work correctly without such (or similar) change at all? How will the unpickler know which module to load when it sees a pickled object of Element type? 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? ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue16076> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com