diff options
author | Benjamin Peterson <benjamin@python.org> | 2010-08-09 13:05:35 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2010-08-09 13:05:35 (GMT) |
commit | 42ac47548de06ac4c022e54abdbdc467f80cecb2 (patch) | |
tree | 568a38c5625be14f35b6d2115b666cbc7e287eb1 /Lib | |
parent | a492362f9a2a44e411147fd7b2886466bb0bb17f (diff) | |
download | cpython-42ac47548de06ac4c022e54abdbdc467f80cecb2.zip cpython-42ac47548de06ac4c022e54abdbdc467f80cecb2.tar.gz cpython-42ac47548de06ac4c022e54abdbdc467f80cecb2.tar.bz2 |
don't alias directly, so that extra arguments don't appear #6678
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/inspect.py | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/Lib/inspect.py b/Lib/inspect.py index bfb6d00..1690f94 100644 --- a/Lib/inspect.py +++ b/Lib/inspect.py @@ -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.""" |