Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Embedding: Howto get object's dictonary

Reply
Thread Tools

Embedding: Howto get object's dictonary

 
 
Oliver Eichler
Guest
Posts: n/a
 
      10-13-2004
Hi,

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".

Thanks for help

Oliver
 
Reply With Quote
 
 
 
 
Fredrik Lundh
Guest
Posts: n/a
 
      10-13-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)

</F>



 
Reply With Quote
 
 
 
 
Oliver Eichler
Guest
Posts: n/a
 
      10-13-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."?


Oliver
> </F>


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Dictonary persistance weirdness =?iso-8859-1?q?Gonzalo_Sainz-Tr=E1paga_=28GomoX=29?= Python 3 04-11-2005 03:39 AM
Howto get 'debug' commands on a PIX 501 to work? Nibly Cisco 6 02-22-2005 04:28 PM
Dictonary Andreas Beresko Java 2 02-22-2005 10:20 AM
Loading a Cookie from a Dictonary Michael Sampson Python 3 02-07-2004 12:47 AM



Advertisments