[Patches] [Patch #102106] sys._getframe() for getting the current stack frame

noreply@sourceforge.net noreply@sourceforge.net
Thu, 26 Oct 2000 07:15:45 -0700


Patch #102106 has been updated. 

Project: python
Category: core (C code)
Status: Open
Summary: sys._getframe() for getting the current stack frame

Follow-Ups:

Date: 2000-Oct-24 20:43
By: bwarsaw

Comment:
This patch adds a function to the sys module which will return a frame object.  By default, it returns the frame object of the current stack frame, but an optional integer argument can be supplied to retrieve any frame higher up the stack.  If the integer is greater than the depth of the stack, a ValueError is raised.
-------------------------------------------------------

Date: 2000-Oct-24 21:43
By: fdrake

Comment:
My only comment on the docs (both docstring and LaTeX) is that it should say "ValueError is raised" rather than "a ValueError is raised" (drop the "a").  Otherwise looks good; I've not run it through the formatting.
-------------------------------------------------------

Date: 2000-Oct-24 21:51
By: bwarsaw

Comment:
Good point.  Patch updated.  Thanks.
-------------------------------------------------------

Date: 2000-Oct-24 21:54
By: bwarsaw

Comment:
Oops, fixed one small typo.
-------------------------------------------------------

Date: 2000-Oct-26 07:15
By: gvanrossum

Comment:
The docstring and docs should say that the default depth is zero.
They should also mention that this is for internal use only.
Can you implement this in Jython too?
-------------------------------------------------------

-------------------------------------------------------
For more info, visit:

http://sourceforge.net/patch/?func=detailpatch&patch_id=102106&group_id=5470