summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
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)