Index: Lib/inspect.py =================================================================== --- Lib/inspect.py (revision 74214) +++ Lib/inspect.py (working copy) @@ -947,7 +947,10 @@ tb = tb.tb_next return framelist -currentframe = sys._getframe +if hasattr(sys, '_getframe'): + currentframe = sys._getframe +else: + currentframe = lambda: None def stack(context=1): """Return a list of records for the stack above the caller's frame."""