Name
Py_InitModule3
Synopsis
PyObject* Py_InitModule3(char*name,PyMethodDef*methods,char*doc)
name is the C string name of the module
you are initializing (e.g., "name“).
methods is an array of
PyMethodDef structures, covered next in this
chapter. doc is the C string that becomes
the docstring of the module. Py_InitModule3
returns a PyObject* that is a borrowed reference
to the new module object, as covered in Section 24.1.5 later in this chapter. In
practice, this means that you can ignore the return value if you need
to perform no more initialization operations on this module.
Otherwise, assign the return value to a C variable of type
PyObject* and continue initialization.
Py_InitModule3 initializes the module object to
contain the functions described in table
methods. Further initialization, if any,
may add other module attributes, and is generally best performed with
calls to the following convenience functions.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access