loading extension problem
Martin von Loewis
loewis at informatik.hu-berlin.de
Thu May 24 18:06:46 CEST 2001
mrovner at visteon.com (Mike Rovner) writes:
> I wrote an extension to my C application and it works just fine.
> I used it on several computers with Solaris 2.7 and 2.8
> The problem arise when I try to use it on another computer with
> Solaris 2.6.
> On that machine it refuses even to load.
Did you try recompiling the extension for each of the Solaris
versions, or are you using the same binaries everywhere?
> #2 0x0003531c in Py_InitModule4(name=0xc1840,methods=0xff0a27ac,doc=0x0,passthrough=0x0,module_api_version=0xc1768)
> in 'modsupport.c', line 57
> #1 0x00052edc in PyDict_SetItemString(v=0x103f94,key=0x91aa8,item=0xc1768)
> in 'dictobject.c', line 1225
> #0 0xff136cbc in strlen(0x091aa8,0x0,0x0a2400,0x0,0x0,0x0)
> /home/miker/dl/Python-2.0/Objects/dictobject.c, line 1225
> PyObject *kv;
> int err;
> => kv = PyString_FromString(key);
> if (kv == NULL)
> return -1;
What is the value of key here? Is it a proper string? If not, is it
still a proper string in the caller?
> Well, it doesn't make much sense for me.
It is trying to insert all the methods of the module into the module
dictionary. To do so, it invokes strlen on each of the strings. That
should not crash; please have a look at the various pointers and see
whether they look reasonable.
> May be someone can direct me.
Another possibility is that it picks up some wrong module, e.g. one
compiled for a different Python version. Try invoking python -v to see
whether it does something strange, and perhaps strace/truss python to
see what shared libraries it loads.
I'm concerned that module_api_version looks wrong. It should have a
value of 1009, but the debugger claims the value is 0xc1768. Maybe the
debugger is wrong: it also claims that "item" in the call to
PyDict_SetItemString has that value - perhaps it's just that the
compiler has recycled the register carrying the parameter.
More information about the Python-list