[Python-Dev] PyTypeObject type names in Modules/ (original) (raw)
Eli Bendersky eliben at gmail.com
Thu Jan 3 15:46:27 CET 2013
- Previous message: [Python-Dev] PyTypeObject type names in Modules/
- Next message: [Python-Dev] PyTypeObject type names in Modules/
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Thu, Jan 3, 2013 at 6:43 AM, Benjamin Peterson <benjamin at python.org>wrote:
2013/1/3 Eli Bendersky <eliben at gmail.com>: > > >> >> >> >> 2013/1/1 Eli Bendersky <eliben at gmail.com>: >> >> > Hello and happy 2013, >> >> > >> >> > Something I noticed earlier today is that some C versions of stdlib >> >> > modules >> >> > define their name similarly to the Python version in their >> >> > PyTypeObject. >> >> > Some examples: Decimal, xml.etree's Element. Others prepend an >> >> > understore, >> >> > like pickle.Pickler and many others. >> >> > >> >> >> >> I don't it's terribly important except if the object from the C module >> >> is directly exposed through the API it's nicer if it's name >> >> doesn't have a leading underscore. >> > > > > As a followup question: would it be considered a compatibility-breaking > change to rename PyTypeObject names? As a concrete example, in > Modules/elementtree.c the name of ElementType (essentially the > xml.etree.ElementTree.Element replacement in C) is "Element". For the > purpose of pickling/unpickling it should be named "elementtree.Element" or > "xml.etree.ElementTree.Element" or some such thing. Can such a change be > made between 3.3 and 3.4? Between 3.3 and 3.3.1?
I don't know much about etree. Can you pickle Element?
etree has a C accelerator that was improved and extended in 3.3 and was made the default when importing etree. But a regression (issue #16076) occurs because _elementree.Element has no pickling support, while the Python version does by default (being a plain Python class). In the aforementioned issue we're trying to resolve the strategy for supporting pickling for _elementtree.Element. I hope my understanding of unpickling is correct - it does need a class name to find the module that can unpickle the object, right? If this is correct, than such a change (name of the type) may be required to solve the regression between 3.3 and 3.3.1
Eli -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20130103/2965b960/attachment.html>
- Previous message: [Python-Dev] PyTypeObject type names in Modules/
- Next message: [Python-Dev] PyTypeObject type names in Modules/
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]