diff --git a/python/helpers/pycharm_generator_utils/module_redeclarator.py b/python/helpers/pycharm_generator_utils/module_redeclarator.py index 0ab6dc14b600..fdb4dd58cf10 100644 --- a/python/helpers/pycharm_generator_utils/module_redeclarator.py +++ b/python/helpers/pycharm_generator_utils/module_redeclarator.py @@ -284,7 +284,13 @@ class ModuleRedeclarator(object): else: # a forward / circular declaration happens notice = "" - real_value = cleanup(repr(p_value)) + try: + representation = repr(p_value) + except Exception: + import traceback + traceback.print_exc(file=sys.stderr) + return + real_value = cleanup(representation) if found_name: if found_name == as_name: notice = " # (!) real value is %r" % real_value