Initializing PyObject_HEAD in place
Anton Graph
"aglyport\" at n-o.s,p/a__m.yahoo.com>
Fri May 17 18:19:48 EDT 2002
Anton Graph wrote:
> I have a class derived from PyObject:
>
> class MetaFld : public PyObject /* python header: ref. counter +
> &typeobject */ {
> friend class MCI<MetaFld>;
> MetaFld *next;
> protected:
> long n_id; // for(fldnum=recnum-10000;;++fldnum) n_id = fldnum;
> ......
>
>
> The initialization in constructor
>
> MetaFld::MetaFld(MetaRec *owner, const char *name, const char *type,
> const char *field_name_postfix)
> : PyObject(&metafldtype), .......
>
> worked like that before (last time I compile this which was 3 years ago
> ot so). Not sure how, but it did. Well, today it did not. Maybe someone
> upgraded Python to 1.4 in that time period.
> So, my question is how would I inittialize PyObject struct (the base of
> my class) in the constructor or my class? I need something like
> _PyObject_New() as defined for core dll in windows, that is with
> allocated space passed as a second parameter.
>
> I'm using Python 1.4 on SCO OpenServer and would rather not upgrade to
> latest and greatest (2.2.1?) unless there is a pressing need for that.
>
> I've checked the tutorial and took a brief look at FAQ: this does not
> seem to be covered.
>
> Thank you!
>
Nevermind, I figured I was using Cameau C++ instead of SCO C++ back then.
More information about the Python-list
mailing list