Embedding: Howto get object's dictonary

Fredrik Lundh fredrik at pythonware.com
Wed Oct 13 03:25:32 EDT 2004

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)


More information about the Python-list mailing list