[Python-Dev] API bloat
Georg Brandl
g.brandl at gmx.net
Thu Feb 10 19:07:38 CET 2011
Am 10.02.2011 15:26, schrieb Mark Shannon:
> M.-A. Lemburg wrote:
>> Mark Shannon wrote:
>>> Nick Coghlan wrote:
>>>> On Thu, Feb 10, 2011 at 8:16 PM, Mark Shannon <marks at dcs.gla.ac.uk>
>>>> wrote:
>>>>> Doing a search for the regex: "PyAPI_FUNC\([^)]*\) *Py" in .h files,
>>>>> which should match API functions (functions starting _Py are
>>>>> excluded) gives
>>>>> the following result:
>>>>>
>>>>> Version matches
>>>>> 3.0 717
>>>>> 3.1.3 728
>>>>> 3.2b2 743
>>>>>
>>>>> It would appear the API bloat is real,
>>>>> not just an artefact of updated docs.
>>>> Since it doesn't account for #ifdef, a naive count like that isn't a
>>>> valid basis for comparison.
>>>>
>>> OK. How about this:
>>>
>>> egrep -ho '#.*PyAPI_FUNC\([^)]*\)( |\n)*Py\w+' Include/*.h
>>> finds no matches.
>>>
>>> egrep -ho 'PyAPI_FUNC\([^)]*\)( |\n)*Py\w+' Include/*.h | sort -u
>>>
>>> This finds all matches and removes duplicates, so anything defined
>>> multiple time in branches of #ifdef blocks, will only be counted once.
>>>
>>> Version matches
>>> 3.0 714
>>> 3.1.3 725
>>> 3.2b2 739
>>
>> Given these numbers, I don't think the subject line really
>> captures the problem accurately enough ... a 2% increase
>> in number of API function per release can hardly be called
>> API bloat :-)
>>
>>> So given, the revised numbers;
>>>
>>> The "what's new for 3.2" API section:
>>> http://docs.python.org/dev/py3k/whatsnew/3.2.html#build-and-c-api-changes
>>> lists 6 new functions, yet 14 have been added between 3.1.3 and 3.2b2.
>>
>> Could you identify the ones that are not yet documented ?
>>
>> That would be useful.
>
> Here's the details:
>
> The following API functions were removed from 3.1.3:
>
> PyAST_Compile
This is not correct, for example: this function is still present as
a #define (and there is also a stub implementation so that extensions
compiled against earlier versions can import the symbol).
Georg
More information about the Python-Dev
mailing list