From 165700c914cd46e5c71d8ee9e6854fb80b642031 Mon Sep 17 00:00:00 2001 From: Yuto Takano Date: Mon, 16 Aug 2021 10:39:24 +0100 Subject: [PATCH] Remove unnecessary try/catch in list_internal_identifiers The try/catch was used to catch Exceptions and exit with code 1, a legacy from check_names.py which uses the pattern to exit with code 2. But code 1 is the default for the Python runtime anyway, so it is redundant and can be removed. Signed-off-by: Yuto Takano --- tests/scripts/list_internal_identifiers.py | 23 +++++++++------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/tests/scripts/list_internal_identifiers.py b/tests/scripts/list_internal_identifiers.py index f18491bad9..d1b55138f1 100755 --- a/tests/scripts/list_internal_identifiers.py +++ b/tests/scripts/list_internal_identifiers.py @@ -44,21 +44,16 @@ def main(): parser.parse_args() - try: - name_check = CodeParser(logging.getLogger()) - result = name_check.parse_identifiers([ - "include/mbedtls/*_internal.h", - "library/*.h" - ]) - result.sort(key=lambda x: x.name) + name_check = CodeParser(logging.getLogger()) + result = name_check.parse_identifiers([ + "include/mbedtls/*_internal.h", + "library/*.h" + ]) + result.sort(key=lambda x: x.name) - identifiers = ["{}\n".format(match.name) for match in result] - with open("identifiers", "w", encoding="utf-8") as f: - f.writelines(identifiers) - - except Exception: # pylint: disable=broad-except - traceback.print_exc() - sys.exit(1) + identifiers = ["{}\n".format(match.name) for match in result] + with open("identifiers", "w", encoding="utf-8") as f: + f.writelines(identifiers) if __name__ == "__main__": main()