Re: Adding and attribute to an instance

2005-08-10 Thread Martin v. Löwis
Gregory Bond wrote: > Make sure you init this member to 0 (tp_init), and make sure you > PyXDECREF() it when the object is deleted (tp_dealloc). As this may cause your objects to appear in cycles, you may also have to add support for cyclic GC (unless you already did this before, and unless you ca

Re: Adding and attribute to an instance

2005-08-10 Thread Gregory Bond
J wrote: > I have looked at some of the source code in PyObject_GenericGetAttr and > it turns out that the object has no dictionary. It seens that the > address of the dictionary is computed somehow via tp_dictoffset in the > type object. I asked this a few months ago.. Basically, you need a

Re: Adding and attribute to an instance

2005-08-09 Thread Jeremy Moles
Hmmm--I would also be interested in knowing the answer to this. I get the exact same behavior as the OP (probably because it's the intended behavior?) On Tue, 2005-08-09 at 14:38 -0700, J wrote: > Hi, > > > I am trying to add new data attributes to my extension classes from > within a script. I

Adding and attribute to an instance

2005-08-09 Thread J
Hi, I am trying to add new data attributes to my extension classes from within a script. I am under the impression that python allows that implicity This is the definition of my class PyTypeObject CmdPlace::PyType = { PyObject_HEAD_INIT(NULL) 0, /*ob_size*/