Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #17881 > unrolled thread

help - obtaining the type of the object using tp_name

Started byMrinalini Kulkarni <mrinalini@edss.co.in>
First post2011-12-25 16:58 +0530
Last post2011-12-25 16:58 +0530
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python


Contents

  help - obtaining the type of the object using tp_name Mrinalini Kulkarni <mrinalini@edss.co.in> - 2011-12-25 16:58 +0530

#17881 — help - obtaining the type of the object using tp_name

FromMrinalini Kulkarni <mrinalini@edss.co.in>
Date2011-12-25 16:58 +0530
Subjecthelp - obtaining the type of the object using tp_name
Message-ID<mailman.4062.1324814226.27778.python-list@python.org>
 Hello,

 I have embedded python into a vc++ app. I need to obtain type of the 
 variable defined in the python script, in my c++ code.

 PyObject *pMyObject; -> assume points to a variable defined in the 
 python script

 Now I want to do something like this

 const char * typeName;

 typeName = pMyObject->ob_type->tp_name

 Is this possible ? I tried doing this but it crashes.

 What is the alternative way for getting the name of the type from 
 python. Is there a function available for this purpose such that I can 
 obtain the address of that function using GetProcAddress and then use it 
 for determining the type. (I am required to link to python dynamically)

 thanks,
 MK

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web