Python 2.3.2 & Netware

Jeff Davey j at submersion.com
Tue Nov 11 05:34:37 CET 2003


I spent the day porting & building a .a that I could link into an NLM 
(statically) and run on Netware, for the purpose of using Python in an 
application.

So far, everything (from the compiling process) works great. I built a 
little test.nlm to see if everything works good:

#include <Python.h>

int main(int argc, char *argv[])
{
    Py_Initialize();
    PyRun_SimpleString("print 'Hi there'\n");
    Py_Finalize();
    return 0;
}

I then loaded up this NLM (of like, 3.8MB or so) into protected memory 
space on a Netware 5.1 server.

Near instantly, I get an abend of such:
Removed address space because of memory protection violation
Reason: Free detected corrupt preceeding redzone for node

So, I wade through the Python source to discover what's happening:

Py_Initialize() is called
 From there we get down to _Py_ReadyTypes();

In _Py_ReadyTypes we get to the first line:
if (PyType_Ready(&PyType_Type) <0)


In PyType_Ready we initialize the base class (ie: recurse once), and 
proceed to the following (about to do the type type):

if (add_operators(type) < 0)
	goto error;


Following that we get to add_operators:
descr = PyDescr_NewWrapper(type, p, *ptr);

and further down in PyDescr_NewWrapper..
descr = (PyWrapperDescObject *)descr_new(&PyWrapperDescr_Type, type, 
base->name);
Just to note, the name here is '__cmp__'

Then in descr_new (getting close now, I promise! :):
descr->d_name = PyString_InternFromString(name);

In that particular function, the abend seems to happen in 
PyString_InternInPlace(&s)

So Following that, and this is where the abend happens,

In PyString_InternInPlace(PyObject **p) you have this:

if ((t = PyDict_GetItem(interned, (PyObject *)s)) != NULL {
   Py_INCREF(t);
   Py_DECREF(*p); // THE ABEND IS HERE
   *p = t;
   return;
}

The abend happens on the Py_DECREF(*p).

Now, I had a hard time trying to figure out exactly what this type of 
abend means, but from what I understand, that peice of memory has been 
corrupted at some point.

When I ported this, I modified the pyconfig.h by hand, perhaps this 
problem is caused by inserting a wrong value (which I sort of doubt 
right now...) into the 'type' sizes ?

Let me know if you have any ideas....

Thanks!

Jeff Davey





More information about the Python-list mailing list