This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author coder_5
Recipients
Date 2006-01-31.03:19:28
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
signature is:

int PyImport_AppendInittab(char *name, void
(*initfunc)(void))

if the 'name' pointer is freed or overwritten directly
after the call to PyImport_AppendInittab, this call
returns true but fails making the module known, and the
interpreter crashes on PyFinalize();
this suggests that PyImport_AppendInittab stores the
name pointer and uses it later, after leaving this
function. this is undocumented and leads to crashes if
name is freed in the meantime. (a typical c problem)

this function is important to boost::python library to
extend python with c++.

workaround for c/c++ users:
-malloc a char* for the name,
-copy the modulename to name
-call PyImport_AppendInittab with this name
-DONT free name. (leaving a memory-leak)


btw, 'char *' should be 'const char*', but this applies
to most other Python API functions.
History
Date User Action Args
2007-08-23 14:37:33adminlinkissue1419652 messages
2007-08-23 14:37:33admincreate