[Python-Dev] Cleanup of abstract.h header

Victor Stinner victor.stinner at gmail.com
Thu Dec 15 05:22:10 EST 2016


Hi,

I made multiple changes to the Include/abstract.h header file, because
it was inconsistent in different manners:

* Parameter names of functions of the PyObject_Call family were
inconsistent: "func" versus "callable" for a Python callable object
for example (sometimes, .c and .h files were inconsistent too)

* Only this header file used an indentation of 4 spaces in the whole space

* Only this header used comments *after* the function declaration and
with a newline between the comment and the declaration. Other headers
use a comment *before* the declaration and no newline.

* Some comments were far (100 lines) from function declaration, so it
wasn't possible anymore to understand these comments.

* Other tiny changes

Before:
https://hg.python.org/cpython/file/f692dafe6797/Include/abstract.h

Now:
https://hg.python.org/cpython/file/c4bcca326c0a/Include/abstract.h

(Not sure that it's easy to compare such long header file, ~1 200
lines, in a web browser.)

See http://bugs.python.org/issue28838 for more information.


Serhiy Storchaka was opposed to these changes, some extract of his comments:

* "Isn't this just a lot of churn for not a lot of benefit?" - Eric V.
Smith asked the same question
* "It breaks "hg annotation" and makes harder researching the history
of the file"

I already pushed all my changes anyway, but Serhiy asked me to discuss
these changes on Python-Dev, so here I am.


I decided to cleanup abstract.h because I had to modify it multiple
times last 2 years, especially when I added new functions for fast
calls, and I was always surprised and confused by the style of header.
I didn't know how to format my code, and it seems like I also
introduced some inconsistent coding style in the newly added code.

For the first change that I made recently, normalizing parameter
names, I first pushed directly a change without review, but Serhiy
asked me on this list to revert it. So I reverted the change and
continued the discussion on the issue #28838. We agreed on better
names, and so I pushed a different change.

Victor


More information about the Python-Dev mailing list