[Python-Dev] Get fame and fortune from mindless editing

Mark Hammond mhammond@skippinet.com.au
Wed, 31 Jul 2002 16:43:50 +1000


An offer too good to refuse ;)

We recently deprecated the DL_EXPORT and DL_IMPORT macros, replacing them
with purpose oriented macros.  In an effort to cleanup the source, it would
be good to remove all such macros from the Python source tree.

I have already made a start on this, and only mindless editing remains.
What needs to be done is:

* Modules/*.c - all 'DL_EXPORT(void)' references (which are all module init
functions) are to be replaced with 'PyMODINIT_FUNC' - note no parens, and
not no return type is specified.

Eg, the following patch would be most suitable <wink>:
Index: timemodule.c
...
@@ -621,5 +621,5 @@


-DL_EXPORT(void)
+PyMODINIT_FUNC
 inittime(void)
 {

* Include/*.h - all public declarations need to be changed. All
'DL_IMPORT(type)' references, *including* any leading 'extern' declaration,
should be changed to either PyAPI_FUNC (for functions) or PyAPI_DATA (for
data)

For example, the following 3 lines (from various .h files):
extern DL_IMPORT(PyTypeObject) PyUnicode_Type;
extern DL_IMPORT(PyObject*) PyUnicode_FromUnicode(...);
DL_IMPORT(void) PySys_SetArgv(int, char **);

would be changed to:
PyAPI_DATA(PyTypeObject) PyUnicode_Type;
PyAPI_FUNC(PyObject*) PyUnicode_FromUnicode(...);
PyAPI_FUNC(void) PySys_SetArgv(int, char **);

Note all 'extern' declarations were removed, and PyUnicode_Type is data (and
declared as such) while the other 2 are functions.

This is all mindless editing, suitable for a day when the brain doesn't
quite seem to be firing!  The fame comes from getting your name splashed all
over the CVS logs.  The fortune... well, not all valuable things can be
measured in dollars <wink>.

Thanks,

Mark.