]> granicus.if.org Git - python/commitdiff
don't alias directly, so that extra arguments don't appear #6678
authorBenjamin Peterson <benjamin@python.org>
Mon, 9 Aug 2010 13:05:35 +0000 (13:05 +0000)
committerBenjamin Peterson <benjamin@python.org>
Mon, 9 Aug 2010 13:05:35 +0000 (13:05 +0000)
Lib/inspect.py

index bfb6d00b5baf192cb38a1428df04ab64f5fcd662..1690f94771633b6e6230017e03242dddbd5a8d21 100644 (file)
@@ -1062,10 +1062,9 @@ def getinnerframes(tb, context=1):
         tb = tb.tb_next
     return framelist
 
-if hasattr(sys, '_getframe'):
-    currentframe = sys._getframe
-else:
-    currentframe = lambda _=None: None
+def currentframe():
+    """Return the frame or the caller or None if this is not possible."""
+    return sys._getframe(1) if hasattr(sys, "_getframe") else None
 
 def stack(context=1):
     """Return a list of records for the stack above the caller's frame."""