From b68244d7e84dbc9c4d805c79d9a644e3526146ce Mon Sep 17 00:00:00 2001 From: Michele Simionato Date: Mon, 16 Mar 2015 13:25:51 +0100 Subject: Supported implementations without sys._getframe --- src/decorator.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src') 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) -- cgit v1.2.1