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


Groups > comp.lang.python > #12663

Re: Help required accessing dictionary

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'python.': 0.04; 'statically': 0.07; 'python': 0.08; '#define': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:80.91.229.12': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'received:lo.gmane.org': 0.09; 'dictionary,': 0.16; 'from:addr:yahoo.com.ar': 0.16; 'macro,': 0.16; 'null.': 0.16; 'pyobject': 0.16; 'python.h': 0.16; 'subject:required': 0.16; 'wed,': 0.17; 'subject:Help': 0.17; "doesn't": 0.22; 'dictionary': 0.23; 'macros': 0.23; 'aug': 0.24; 'skip:p 30': 0.28; 'script.': 0.29; 'script': 0.29; 'object.': 0.30; 'to:addr:python-list': 0.33; 'done': 0.34; 'however,': 0.34; 'header:User-Agent:1': 0.34; 'declared': 0.34; 'function.': 0.34; 'header:X-Complaints-To:1': 0.35; 'running': 0.35; 'checks': 0.37; 'variables': 0.37; 'perform': 0.37; 'think': 0.38; 'received:org': 0.38; 'subject:: ': 0.39; 'header:Mime-Version:1': 0.39; 'to:addr:python.org': 0.39; 'received:190': 0.76; '-0300,': 0.84; 'genellina': 0.84; 'gabriel': 0.91
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From "Gabriel Genellina" <gagsl-py2@yahoo.com.ar>
Subject Re: Help required accessing dictionary
Date Fri, 02 Sep 2011 16:10:41 -0300
References <54e7c93d35c11cdf72cee56a8a1c5abc@edss.co.in>
Mime-Version 1.0
Content-Type text/plain; charset=iso-8859-1; format=flowed; delsp=yes
Content-Transfer-Encoding 8bit
X-Gmane-NNTP-Posting-Host 190.2.4.25
User-Agent Opera Mail/11.51 (Win32)
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.714.1314990637.27778.python-list@python.org> (permalink)
Lines 31
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1314990638 news.xs4all.nl 2473 [2001:888:2000:d::a6]:59817
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:12663

Show key headers only | View raw


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

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

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

csiph-web