[Patches] [Patch #102106] sys._getframe() for getting the current stack frame
noreply@sourceforge.net
noreply@sourceforge.net
Wed, 6 Dec 2000 01:24:18 -0800
Patch #102106 has been updated.
Project: python
Category: core (C code)
Status: Open
Submitted by: bwarsaw
Assigned to : bwarsaw
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?
-------------------------------------------------------
Date: 2000-Dec-06 01:24
By: ping
Comment:
It's a small point, but i'd much prefer the function to be called
sys.getframe() rather than sys._getframe(). There aren't
any other functions in sys that begin with an underscore,
and it's understood that routines in sys manipulate the
Python interpreter system anyway (such as getrefcount
or exc_info). This routine isn't private within sys; it's
exported by sys, so it should be called sys.getframe().
-------------------------------------------------------
-------------------------------------------------------
For more info, visit:
http://sourceforge.net/patch/?func=detailpatch&patch_id=102106&group_id=5470