[Python-Dev] Missing PY_ prefixes in structmember.h

Serhiy Storchaka storchaka at gmail.com
Mon Oct 3 14:10:37 EDT 2016


On 03.10.16 16:37, Skip Montanaro wrote:
> I'm sure this has a simple explanation (and is probably only of
> historical interest at this point), but ...
>
> While starting to port the Python Sybase module to Python 3, among other
> hurdles, I noticed that RO is no longer defined. Looking in
> structmember.h, I see that most of the macros defined there are missing
> a PY_ prefix. Given that these are macros which are likely to be used by
> extension modules and are thus really part of the C API, shouldn't they
> have PY_ or _PY_ prefixes? This file got its start in 1990, so would
> surely have been around for the great renaming
> <http://python-history.blogspot.com/2009/03/great-or-grand-renaming.html>.
> Looking at the documentation on defining new types, I saw no mention of
> these peculiarly named constants, though they are clearly documented.

structmember.h is not included in Python.h. I think it was not 
considered as the part of public C API.

But PyMemberDef and constants are documented and structmember.h is used 
in C API examples.

There are other problems with these constants. Opened an issue for this: 
http://bugs.python.org/issue28349 .




More information about the Python-Dev mailing list