Q: Py_InitModule

Michael P. Reilly arcege at shore.net
Thu Feb 3 08:33:35 EST 2000

rerwig at my-deja.com wrote:
: On learning on ho to write extension modules, I
: found the piece of information below:

: Module documentation string

: By far the easiest, add a character string
: argument to the end of Py_InitModule.

:      void
:      initmodname()
:        {
:          static char modname__doc__[] = "\
:      This module contains some functions,
: constants and maybe a type.";

:          (void)Py_InitModule("modname", methods,
: modname__doc__);
:        }

: However, compiling it produces an warning as
: Py_InitModule only expects 2 parms, not 3.
: What am I missing?

You need to call Py_InitModule3() for a 3-argument call.
  (void)Py_InitModule("modname", methods, modname__doc__);

That's what you get when you proof your own work.  I've corrected the
existing online documentation already.  My apologies.


More information about the Python-list mailing list