[IronPython] sys._getframe(n)?

2009-04-29 Thread Mike Krell
Is it true that the dev team is considering implementing
sys._getframe(n) where n  0?  I'd love to see this since my
understanding is that this is a stumbling block for running IronPython
under IPython.

Is there an issue number on CodePlex on this that I can vote for?

   Thanks,
   Mike
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] sys._getframe(n)?

2009-04-29 Thread Dino Viehland
Yep, we're going to make it available via a command line option.  The
Interesting question is what does IPython need from frames?  Does it
need locals (which frequently won't be available), globals, the function
or code, or something else?

I think bug 1042 is the one to vote on:
http://ironpython.codeplex.com/WorkItem/View.aspx?WorkItemId=1042


 -Original Message-
 From: users-boun...@lists.ironpython.com [mailto:users-
 boun...@lists.ironpython.com] On Behalf Of Mike Krell
 Sent: Wednesday, April 29, 2009 6:19 AM
 To: Users@lists.ironpython.com
 Subject: [IronPython] sys._getframe(n)?
 
 Is it true that the dev team is considering implementing
 sys._getframe(n) where n  0?  I'd love to see this since my
 understanding is that this is a stumbling block for running IronPython
 under IPython.
 
 Is there an issue number on CodePlex on this that I can vote for?
 
Thanks,
Mike
 ___
 Users mailing list
 Users@lists.ironpython.com
 http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] sys._getframe(n)?

2009-04-29 Thread Mike Krell
On Wed, Apr 29, 2009 at 8:34 AM, Dino Viehland di...@microsoft.com wrote:
 Yep, we're going to make it available via a command line option.  The
 Interesting question is what does IPython need from frames?  Does it
 need locals (which frequently won't be available), globals, the function
 or code, or something else?

I hadn't looked at the source until now, but a cursory glance suggests
that it typically wants to evaluate expressions with the locals (and
globals) from various stack frames.  Could you discuss in a bit more
detail why certain locals wouldn't be available that would otherwise
be available in CPython?

   Mike
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] sys._getframe(n)?

2009-04-29 Thread Curt Hagenlocher
On Wed, Apr 29, 2009 at 6:19 PM, Mike Krell mbk.li...@gmail.com wrote:

 On Wed, Apr 29, 2009 at 8:34 AM, Dino Viehland di...@microsoft.com wrote:
 Yep, we're going to make it available via a command line option.  The
 Interesting question is what does IPython need from frames?  Does it
 need locals (which frequently won't be available), globals, the function
 or code, or something else?

 I hadn't looked at the source until now, but a cursory glance suggests
 that it typically wants to evaluate expressions with the locals (and
 globals) from various stack frames.  Could you discuss in a bit more
 detail why certain locals wouldn't be available that would otherwise
 be available in CPython?

I don't know the exact answer but I won't let that stop me from
replying. :)  I'll just rely on Dino correcting anything I say that is
wrong...

IronPython is a compiler that ultimately produces MSIL. If it
determines that a particular local variable doesn't need to be
accessed from outside the local scope -- that is, if it's not closed
over and there is no exec or locals() which could target it -- then
that variable simply becomes a local value on the IL stack. The CLR
StackFrame object doesn't give us access to the associated locals, so
we have no way of accessing them from outside (except through CLR
debug APIs, which aren't really applicable for this type of use).

In principle, IronPython could optionally use a less-efficient
representation for locals that would allow us to expose them all of
them through the Python stack frame. I don't know how serious a
performance penalty this would exact, but I imagine it's not small.

The Unladen Swallow project is likely to face similar tradeoffs.

--
Curt Hagenlocher
c...@hagenlocher.org
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com