[Python-Dev] API bloat

Mark Shannon marks at dcs.gla.ac.uk
Wed Feb 9 11:37:11 CET 2011


Georg Brandl wrote:
> Am 09.02.2011 10:09, schrieb Mark Shannon:
>> At sometime between versions 3.1 and the current version, 3.1.3,
>> the API  grew considerably.
>> See
>> http://docs.python.org/release/3.1/c-api/exceptions.html#exception-handling
>> and
>> http://docs.python.org/py3k/c-api/exceptions.html#exception-handling
>>
>> The Unicode Exception Objects section is new and seemingly redundant:
> 
> Why redundant?

Because they are all attribute getter and setters. For example:

PyUnicodeDecodeError_GetStart(exc, x) <=>
PyObject_GetAttr(exc, "start", x)

This sort of redundancy seems sensible for list, tuple and such.
It just seems like bloat for classes like UnicodeDecodeError.

> 
>> http://docs.python.org/py3k/c-api/exceptions.html#unicode-exception-objects
>> Should this be in the public API?
> 
> While this question is valid, it *should* have been asked 8 years ago, when
> the functions were actually added.

The functions may have been add to CPython 8 years ago, but they were
added to the API when they appeared in the docs, between 3.1 and 3.1.3.

How is the API defined, if not by the documentation?
The header files do not specify what is API and what is implementation
specific.

> 
> They are new in the docs because they weren't documented before.  Otherwise
> they would have a "New in version 3.2" tag.
> 
>> Is there any kind of review system (like PEPs) for modifying the C API?
> 
> No, but python-dev is involved by either a thread here or an issue that
> is then OK'd by several developers.
> 
>> Are bug-fix updates really the place to modify the API?
> 
> No, but that's not relevant here.
> 
>> Could the API be reverted to the 3.1 version plus any *necessary* 
>> changes in time for the 3.2 release?
> 
> Any changes in API are definitely forbidden before 3.2.

If that is the case then the API, as defined by
http://docs.python.org/py3k/c-api/index.html
should be same for 3.2 as for 3.1, plus a few functions,
that are explicitly marked as "New in version 3.2".

Unfortunately, that is not currently the case.

> 
> Georg
> 
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> http://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: http://mail.python.org/mailman/options/python-dev/marks%40dcs.gla.ac.uk
> 




More information about the Python-Dev mailing list