summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichele Simionato <michele.simionato@gmail.com>2015-03-16 13:25:51 +0100
committerMichele Simionato <michele.simionato@gmail.com>2015-03-16 13:25:51 +0100
commitb68244d7e84dbc9c4d805c79d9a644e3526146ce (patch)
treea4a2351d7dd7274058c98045be10ad627bc4db2e /src
parentd7d4bac90419a049165da9f29e2b8fef18fa7f33 (diff)
downloadpython-decorator-git-b68244d7e84dbc9c4d805c79d9a644e3526146ce.tar.gz
Supported implementations without sys._getframe
Diffstat (limited to 'src')
-rw-r--r--src/decorator.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/decorator.py b/src/decorator.py
index f180823..4ed7247 100644
--- a/src/decorator.py
+++ b/src/decorator.py
@@ -138,7 +138,12 @@ class FunctionMaker(object):
func.func_defaults = getattr(self, 'defaults', ())
func.__kwdefaults__ = getattr(self, 'kwonlydefaults', None)
func.__annotations__ = getattr(self, 'annotations', None)
- callermodule = sys._getframe(3).f_globals.get('__name__', '?')
+ try:
+ frame = sys._getframe(3)
+ except AttributeError: # for IronPython and similar implementations
+ callermodule = '?'
+ else:
+ callermodule = frame.f_globals.get('__name__', '?')
func.__module__ = getattr(self, 'module', callermodule)
func.__dict__.update(kw)