C++ extension

Graeme g.winter at dl.ac.uk
Wed Jan 7 11:38:41 CET 2004


Hi All,

I guess that this will be a point which has come up in the past, but I can't
find any references to it anywhere. I am writing a Python extension in C++,
and as a part of the extension class I have an STL list of things i.e

class WhatNot
{
public:
        PyObject_HEAD;
.
.
private:
        list<Thing> foo;
};

However, I have found that this works fine when I use the class from C++
code, but doesn't work with PyObject_New (the list is not properly
initialised and I get a segmentation fault.)

Is there an easy way around this problem?

Cheers,

Graeme



More information about the Python-list mailing list