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


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

Re: Help required accessing dictionary

Started by"Gabriel Genellina" <gagsl-py2@yahoo.com.ar>
First post2011-09-02 16:10 -0300
Last post2011-09-02 16:10 -0300
Articles 1 — 1 participant

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

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Help required accessing dictionary "Gabriel Genellina" <gagsl-py2@yahoo.com.ar> - 2011-09-02 16:10 -0300

#12663 — Re: Help required accessing dictionary

From"Gabriel Genellina" <gagsl-py2@yahoo.com.ar>
Date2011-09-02 16:10 -0300
SubjectRe: Help required accessing dictionary
Message-ID<mailman.714.1314990637.27778.python-list@python.org>
En Wed, 31 Aug 2011 22:46:54 -0300, <mrinalini@edss.co.in> escribió:

>  I need to access the dictionary of the script that I am running through
>  my vc++ application by embedding python.
>  I am linking to python dynamically. I want to obtain the dictionary of
>  the script and access the variables declared in the script.
>  However, with the PyObject * that I get from the dictionary, I am not
>  able to find the type of the object. The reason being that
>  GetProcAddress to PyInt_Check returns a NULL. The same thing with
>  PyFloat_Check and so on. I think this is because they are macros and  
>  not
>  exported functions.
>
>  What can be done to be able to perform these checks without statically
>  linking to the pyhon lib ?

Just include python.h
PyInt_Check is completely implemented as a macro, it doesn't call any  
function.

/* from intobject.h */
#define PyInt_Check(op) \
		 PyType_FastSubclass((op)->ob_type, Py_TPFLAGS_INT_SUBCLASS)

/* from object.h */
#define PyType_FastSubclass(t,f)  PyType_HasFeature(t,f)
#define PyType_HasFeature(t,f)  (((t)->tp_flags & (f)) != 0)

-- 
Gabriel Genellina

[toc] | [standalone]


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


csiph-web