From 177c3d0f5a05843471a0f24969fddb6b4a9c1411 Mon Sep 17 00:00:00 2001 From: the-cat-that-codes Date: Sun, 24 May 2020 21:21:34 +0200 Subject: [PATCH 1/2] Changed ParseException message argument The 'message' attribute seems to be not usable since python 3.0 (see PEP #352) but 'msg' is a valid attribute for pyparsing.ParseException. --- tools/ldgen/generation.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/ldgen/generation.py b/tools/ldgen/generation.py index 5e08e177d3..28cc485918 100644 --- a/tools/ldgen/generation.py +++ b/tools/ldgen/generation.py @@ -591,7 +591,7 @@ class SectionsInfo(dict): try: results = parser.parseString(first_line) except ParseException as p: - raise ParseException("Parsing sections info for library " + sections_info_dump.name + " failed. " + p.message) + raise ParseException("Parsing sections info for library " + sections_info_dump.name + " failed. " + p.msg) archive = os.path.basename(results.archive_path) self.sections[archive] = SectionsInfo.__info(sections_info_dump.name, sections_info_dump.read()) From ea07ce1a5a67219e8807480fcfb3ae9010bdcd04 Mon Sep 17 00:00:00 2001 From: Renz Bagaporo Date: Wed, 10 Jun 2020 13:53:51 +0800 Subject: [PATCH 2/2] ldgen: change other accesses of exception message Closes https://github.com/espressif/esp-idf/pull/5336 --- tools/ldgen/fragments.py | 4 ++-- tools/ldgen/generation.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/ldgen/fragments.py b/tools/ldgen/fragments.py index 0339f5849e..227abf464f 100644 --- a/tools/ldgen/fragments.py +++ b/tools/ldgen/fragments.py @@ -107,7 +107,7 @@ class FragmentFile(): try: parse_ctx.fragment.set_key_value(parse_ctx.key, stmts) except Exception as e: - raise ParseFatalException(pstr, loc, "unable to add key '%s'; %s" % (parse_ctx.key, e.message)) + raise ParseFatalException(pstr, loc, "unable to add key '%s'; %s" % (parse_ctx.key, str(e))) return None key = Word(alphanums + "_") + Suppress(":") @@ -139,7 +139,7 @@ class FragmentFile(): except KeyError: raise ParseFatalException(pstr, loc, "key '%s' is not supported by fragment" % key) except Exception as e: - raise ParseFatalException(pstr, loc, "unable to parse key '%s'; %s" % (key, e.message)) + raise ParseFatalException(pstr, loc, "unable to parse key '%s'; %s" % (key, str(e))) key_stmt << (conditional | Group(key_grammar).setResultsName("value")) diff --git a/tools/ldgen/generation.py b/tools/ldgen/generation.py index 28cc485918..60285849aa 100644 --- a/tools/ldgen/generation.py +++ b/tools/ldgen/generation.py @@ -618,7 +618,7 @@ class SectionsInfo(dict): try: results = parser.parseString(sections_info_text) except ParseException as p: - raise ParseException("Unable to parse section info file " + info.filename + ". " + p.message) + raise ParseException("Unable to parse section info file " + info.filename + ". " + p.msg) return results