Message27388
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. |
|
Date |
User |
Action |
Args |
2007-08-23 14:37:33 | admin | link | issue1419652 messages |
2007-08-23 14:37:33 | admin | create | |
|