diff --git a/CHANGES b/CHANGES index 4b09dbfaf..6fabe363d 100644 --- a/CHANGES +++ b/CHANGES @@ -20,6 +20,14 @@ Version 7.0 - `CliRunner.invoke` now may receive `args` as a string representing a Unix shell command. See #664. +Version 6.8 +----------- + +(bugfix release; yet to be released) + +- Disabled sys._getframes() on Python interpreters that don't support it. See + #728. + Version 6.7 ----------- diff --git a/click/_unicodefun.py b/click/_unicodefun.py index 2e83311fc..998b2cb57 100644 --- a/click/_unicodefun.py +++ b/click/_unicodefun.py @@ -14,6 +14,8 @@ def _find_unicode_literals_frame(): import __future__ + if not hasattr(sys, '_getframe'): # not all Python implementations have it + return 0 frm = sys._getframe(1) idx = 1 while frm is not None: diff --git a/click/decorators.py b/click/decorators.py index 989345265..64af01553 100644 --- a/click/decorators.py +++ b/click/decorators.py @@ -235,7 +235,11 @@ def version_option(version=None, *param_decls, **attrs): :param others: everything else is forwarded to :func:`option`. """ if version is None: - module = sys._getframe(1).f_globals.get('__name__') + if hasattr(sys, '_getframe'): + module = sys._getframe(1).f_globals.get('__name__') + else: + module = '' + def decorator(f): prog_name = attrs.pop('prog_name', None) message = attrs.pop('message', '%(prog)s, version %(version)s')