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


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

Re: PyEval_GetLocals and unreferenced variables

Started byChris Angelico <rosuav@gmail.com>
First post2014-11-26 21:35 +1100
Last post2014-11-26 21:35 +1100
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: PyEval_GetLocals and unreferenced variables Chris Angelico <rosuav@gmail.com> - 2014-11-26 21:35 +1100

#81557 — Re: PyEval_GetLocals and unreferenced variables

FromChris Angelico <rosuav@gmail.com>
Date2014-11-26 21:35 +1100
SubjectRe: PyEval_GetLocals and unreferenced variables
Message-ID<mailman.16316.1416998119.18130.python-list@python.org>
On Wed, Nov 26, 2014 at 9:22 PM, Kasper Peeters <kasper@phi-sci.com> wrote:
> That is, I want
> to do:
>
>   def fun():
>      q=3
>      def fun2():
>         cfun()
>      fun2()
>
>   fun()
>
> and access 'q' inside the C-function cfun(). If I simply let it call
> PyEval_GetLocals, then the result will again not contain "q". Is there
> any way in which I can convince python to pull 'q' into the local scope
> from within my C code?

Wouldn't this be a little surprising? Why not simply pass q as a parameter?

ChrisA

[toc] | [standalone]


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


csiph-web