[Python-checkins] r83890 - python/branches/py3k/Lib/inspect.py

benjamin.peterson python-checkins at python.org
Mon Aug 9 15:05:35 CEST 2010


Author: benjamin.peterson
Date: Mon Aug  9 15:05:35 2010
New Revision: 83890

Log:
don't alias directly, so that extra arguments don't appear #6678

Modified:
   python/branches/py3k/Lib/inspect.py

Modified: python/branches/py3k/Lib/inspect.py
==============================================================================
--- python/branches/py3k/Lib/inspect.py	(original)
+++ python/branches/py3k/Lib/inspect.py	Mon Aug  9 15:05:35 2010
@@ -1062,10 +1062,9 @@
         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."""


More information about the Python-checkins mailing list