Or request “multi-phase initialization” by returning the definition struct itself. To PyModule_Create(), and return the resulting module object, The initialization function can either pass a module definition instance See Building C and C++ Extensions or Extending Embedded Python for details. (where the initialization function is added using PyImport_AppendInittab()). Which export an initialization function), or compiled-in modules Modules objects are usually created from extension modules (shared libraries Unencodable filenames, use PyModule_GetFilenameObject() instead. Or if it is not a string, SystemError is raised and NULL is returned.ĭeprecated since version 3.2: PyModule_GetFilename() raises UnicodeEncodeError on Part of the Stable ABI since version 3.7. PyObject * PyModule_GetNameObject ( PyObject * module ) ¶ PyObject_* functions rather than directly manipulate a module’s It is recommended extensions use other PyModule_* and SystemError is raised and NULL is returned. If module is not a module object (or a subtype of a module object), Is the same as the _dict_ attribute of the module object. Return the dictionary object that implements module’s namespace this object PyObject * PyModule_GetDict ( PyObject * module ) ¶ Similar to PyModule_NewObject(), but the name is a UTF-8 encoded PyObject * PyModule_New ( const char * name ) ¶
Changed in version 3.4: _package_ and _loader_ are set to None.