Issue 26827: PyObject *PyInit_myextention -> PyMODINIT_FUNC PyInit_myextention (original) (raw)

Issue26827

Created on 2016-04-22 12:08 by prinsherbert, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Messages (6)
msg264005 - (view) Author: Herbert (prinsherbert) Date: 2016-04-22 12:08
I think PyObject *PyInit_myextention(void) should be PyMODINIT_FUNC PyInit_myextention(void) on https://docs.python.org/3/howto/cporting.html#module-initialization-and-state It didn't work for me until I replaced this with a message in the about 'undefined PyInit_myextention'. However, when I used nm to inspect the .so object file, I fond the PyInit_myextention (but probably with the wrong return type). Moreover, whenever I would remove the same .so importing resulted in a different error complaining that the module does not exist (strongly suggesting that I did not mix up .so files). Good luck!
msg264006 - (view) Author: Herbert (prinsherbert) Date: 2016-04-22 12:09
The exact error was: ImportError: dynamic module does not define init function (PyInit_myextension)
msg264024 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2016-04-22 15:48
https://docs.python.org/3/extending/extending.html#the-module-s-method-table-and-initialization-function documents what Herbert discovered wrong in the porting docs.
msg264025 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2016-04-22 15:49
And in case my comment wasn't obvious, Herbert is right about the error in the docs.
msg264049 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2016-04-23 06:43
New changeset 188af2b4945a by Benjamin Peterson in branch '3.5': fix python 3 mod init function declaration (closes #26827) https://hg.python.org/cpython/rev/188af2b4945a New changeset df0e900b8860 by Benjamin Peterson in branch 'default': merge 3.5 (#26827) https://hg.python.org/cpython/rev/df0e900b8860
msg264050 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2016-04-23 06:49
New changeset 8d6bd32a56a8 by Benjamin Peterson in branch '2.7': fix python 3 mod init function declaration (closes #26827) https://hg.python.org/cpython/rev/8d6bd32a56a8
History
Date User Action Args
2022-04-11 14:58:30 admin set github: 71014
2016-04-23 06:49:21 python-dev set messages: +
2016-04-23 06:43:32 python-dev set status: open -> closednosy: + python-devmessages: + resolution: fixedstage: resolved
2016-04-22 15:49:11 brett.cannon set messages: +
2016-04-22 15:48:34 brett.cannon set keywords: + easynosy: + brett.cannonmessages: +
2016-04-22 12:09:57 prinsherbert set messages: +
2016-04-22 12:08:15 prinsherbert create