Python crash in PyImport_ImportModule

Adrian Leu AdrianLeu at kelseus.com
Thu Feb 21 13:36:54 CET 2002


Hi ! I am getting at the end of my tether with Python. 

I have written a script in Python 2.0 under Windows 2000. I call this
script from inside a C++ class method which has the Py_Initialize()
and Py_finalize() in its constructor and destructor respectively.
Everything seemed to work OK. However, recently a crash started to
appear and it cannot be repeated always. It is in the
PyImport_ImportModule(module_name) function and the stack looks like
this:

__sbh_free_block(tagHeader * 0x03ddbc14, void * 0x04a1f490) line 350 +
6 bytes
_realloc_base(void * 0x04a1f490, unsigned int 96) line 101 + 13 bytes
realloc_help(void * 0x04a1f4b0, unsigned int 60, int 1, const char *
0x00000000, int 0, int 1) line 636 + 16 bytes
_realloc_dbg(void * 0x04a1f4b0, unsigned int 60, int 1, const char *
0x00000000, int 0) line 806 + 27 bytes
realloc(void * 0x04a1f4b0, unsigned int 60) line 755 + 19 bytes
PyNode_AddChild(_node * 0x04a1d310, int 4, char * 0x023ac9b0, int 108)
line 35 + 44 bytes
shift(stack * 0x0569d228, int 4, char * 0x023ac9b0, int 3, int 108)
line 109 + 26 bytes
PyParser_AddToken(parser_state * 0x0569d228, int 4, char * 0x023ac9b0,
int 108, int * 0x0012f010) line 211 + 25 bytes
parsetok(tok_state * 0x049d0c80, grammar * 0x1e1e14f0
__PyParser_Grammar, int 257, perrdetail * 0x0012eff8) line 123 + 34
bytes
PyParser_ParseFile(_iobuf * 0x00286868, char * 0x0012f1ac, grammar *
0x1e1e14f0 __PyParser_Grammar, int 257, char * 0x00000000, char *
0x00000000, perrdetail * 0x0012eff8) line 75 + 21 bytes
PyParser_SimpleParseFile(_iobuf * 0x00286868, char * 0x0012f1ac, int
257) line 941 + 30 bytes
parse_source_module(char * 0x0012f1ac, _iobuf * 0x00286868) line 627 +
18 bytes
load_source_module(char * 0x0012f308, char * 0x0012f1ac, _iobuf *
0x00286868) line 750 + 13 bytes
load_module(char * 0x0012f308, _iobuf * 0x00286868, char * 0x0012f1ac,
int 1) line 1227 + 17 bytes
import_submodule(_object * 0x1e1e8d48 __Py_NoneStruct, char *
0x0012f308, char * 0x0012f308) line 1755 + 33 bytes
load_next(_object * 0x1e1e8d48 __Py_NoneStruct, _object * 0x1e1e8d48
__Py_NoneStruct, char * * 0x0012f41c, char * 0x0012f308, int *
0x0012f304) line 1611 + 17 bytes
import_module_ex(char * 0x00000000, _object * 0x00000000, _object *
0x00000000, _object * 0x00000000) line 1462 + 35 bytes
PyImport_ImportModuleEx(char * 0x0032f21c `string', _object *
0x00000000, _object * 0x00000000, _object * 0x00000000) line 1503 + 21
bytes
PyImport_ImportModule(char * 0x0032f21c `string') line 1436 + 20 bytes

I don't have a clue why this happens and why it is not always
repeatable. Can someone help. Thanks anyway!

Adrian.



More information about the Python-list mailing list