return (PyObject*)myPyType; ...segmentation fault!
Fredrik Lundh
fredrik at pythonware.com
Fri Sep 30 09:32:31 EDT 2005
"elho" wrote:
>> > It is said that the object has a NULL-Pointer when I try to debug it?
>> what object?
> the python one 'myNewPyType'
>
> Sorry, I forgot to change:
> PySDLXMLNodeType = PyMyType
> ..above the corrections
> self = new PyMyObject
> self->lAttribute = lAttribute;
>
> return (PyObject*)self;
unless you have some really clever C++ magic in there that I'm not seeing,
you cannot just use "new" plus a cast to get a valid Python object.
if you want to explicitly create an object, you can use PyObject_New:
http://www.python.org/doc/2.1.3/ext/dnt-basics.html
an alternative is to expose the type object, and leave the rest to Python:
http://www.python.org/doc/current/ext/dnt-basics.html
</F>
More information about the Python-list
mailing list