If I'm understanding correctly,
- PyMODINIT_FUNC in Python 2.X has been replaced by
PyModule_Create
in Python3.X Both return
PyObject*
, however, in Python 3.X, the module's initialization function MUST return thePyObject*
to the module - i.e.PyMODINIT_FUNC PyInit_spam(void) { return PyModule_Create(&spammodule); }
whereas in Python2.X, this is not necessary - i.e.
PyMODINIT_FUNC initspam(void) { (void) Py_InitModule("spam", SpamMethods); }
So, my sanity checking questions are:
- Is my understanding correct?
- Why was this change made?
Right now, I'm only experimenting with very simple cases of C-extensions of Python. Perhaps if I were doing more, the answer to this would be obvious, or maybe if I were trying to embed Python into something else....