PyCheck for a classes defined in python and user data in PyObject_HEAD

sndive at gmail.com sndive at gmail.com
Thu Nov 1 21:13:35 EDT 2007


On Nov 1, 4:14 pm, snd... at gmail.com wrote:
> q#1:
> in C I want to check if a given PyObject is a xml.dom.minidom.Node (or
> a derivative).
> how do i extract a PyTypeObject for such a class?

nevermind, i found an instance object that will work for me
as long as i figure out where is the documentation
beyond this:
http://docs.python.org/api/instanceObjects.html
on the data attrib access and extracting PyClassObject from it.

>
> issue #2
> I'm in a situation when i don't really need to extend python with any
> classes of my own but
> i do have extra luggage for the python data structures such as tuples,
> lists, dictionaries, etc
> on the c++ side. I see no place in PyObject_HEAD where i can stick a
> void* to my extra data.
> If i enter a feature request into bugzilla for python do you think it
> will be well received?
> #ifdefed of course like the prev/next extras.
> I'm surprised noone else is using evil twin approach.
> The reason i'm asking is because while for dictionaries i can stick
> weak pointer back to my c++
> object in a key with an obscure name while in lists this would change
> the list size and thus
> is obviously not as easy to "hide" from the client code.
> a placeholder in a pyobject would've been of help here





More information about the Python-list mailing list