[issue9709] test_distutils warning: initfunc exported twice on Windows

Stefan Krah report at bugs.python.org
Sun Nov 28 12:52:33 CET 2010

Stefan Krah <stefan-usenet at bytereef.org> added the comment:

Thinking about it, declaring PyMODINIT_FUNC as void would be a huge
step backwards. Using PyMODINIT_FUNC is the correct way of doing things.
The current situation punishes developers who actually read the docs.

If a C module stops working because of the change, _all_ the maintainer
has to do is change a single line in the sources. PyMODINIT_FUNC is
nearly 10 years old, so I think this is not too much to ask.

May I suggest deprecating get_export_symbols() for these reasons:

  1) The docstring is incorrect: The function does not 'either
     use export_symbols or "PyInit_" + module_name'. It forcibly
     adds PyInit_" + module_name', if it isn't already present in

  2) PyMODINIT_FUNC - which is nearly 10 years old - has obsoleted
     this function.

  3) Developers who do the right thing are punished, since they have
     to investigate the warning.

It is also possible to leave the function (see initfunc2.patch). Then
again, on its own get_export_symbols() is practically useless.

Added file: http://bugs.python.org/file19854/initfunc2.patch

Python tracker <report at bugs.python.org>

More information about the Python-bugs-list mailing list