Embedding: Howto get object's dictonary
oliver.eichler at dspsolutions.de
Wed Oct 13 03:39:44 EDT 2004
Fredrik Lundh wrote:
> Oliver Eichler wrote:
>> having a PyObject pointer to a python object, how can I get the object's
>> dictionary, if there is any. There seems to be _PyObject_GetDictPtr() but
>> this looks quite like a internal "you must not use it".
> I'd say it's more of an "be very careful", along the lines of
> _PyString_Resize, _PyTuple_Resize, and other functions that can cause all
> sorts of trouble if you use them carelessly.
> (note btw that the function returns a pointer to the dictionary pointer,
> not the dictionary itself)
yep, I've noticed. Leaving me still with the uncertain feeling wether there
is a better way to get the dict, or not. I mean, why is there no
PyObject_GetDictPtr() returning a new or borrowed reference? Any other
reason than "Nobody did implement it, so far."?
More information about the Python-list