[Patches] [ python-Patches-490374 ] make inspect.stack() work with PyShell

noreply@sourceforge.net noreply@sourceforge.net
Fri, 07 Dec 2001 12:07:40 -0800


Patches item #490374, was opened at 2001-12-07 11:57
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=490374&group_id=5470

Category: Library (Lib)
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Jason Orendorff (jorend)
>Assigned to: Nobody/Anonymous (nobody)
Summary: make inspect.stack() work with PyShell

Initial Comment:
I'm on Python 2.2b2 on Windows.

Changed the 'inspect' module to use 'linecache' for 
loading source code.  This is more efficient.  
Also, 'inspect' now can see the source code of stuff 
entered in the IDLE PyShell.

E.g. In IDLE, type:
>>> import inspect
>>> inspect.stack()[0]

Without the patch, the output would be like this:
(<frame object at 0x009299D0>, None, 1, '?', None, 
None)

With this patch:
(<frame object at 0x009E9580>, '<pyshell#36>', 1, '?', 
['inspect.stack()[0]'], 0)



----------------------------------------------------------------------

>Comment By: Jason Orendorff (jorend)
Date: 2001-12-07 12:07

Message:
Logged In: YES 
user_id=18139

I'm afraid it's definitely a feature.  (sigh)


----------------------------------------------------------------------

Comment By: Guido van Rossum (gvanrossum)
Date: 2001-12-07 12:04

Message:
Logged In: YES 
user_id=6380

Assigned to Tim for review, since he knows inspect.py
inside-out. :-)

It's probably too late for 2.2, unless you can prove this is
a bugfix and not a feature.

----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=490374&group_id=5470