diff --git a/test/bytecode_3.8_run/05_long_literals.pyc b/test/bytecode_3.8_run/05_long_literals.pyc index 665b3767..38c0ed30 100644 Binary files a/test/bytecode_3.8_run/05_long_literals.pyc and b/test/bytecode_3.8_run/05_long_literals.pyc differ diff --git a/test/simple_source/expression/05_long_literals.py b/test/simple_source/expression/05_long_literals.py index 24c4e3c6..f03d4493 100644 --- a/test/simple_source/expression/05_long_literals.py +++ b/test/simple_source/expression/05_long_literals.py @@ -726,9 +726,12 @@ values = { assert sorted(values.values())[1:] == list(range(2, 34)) +def assert_equal(x, y): + assert x == y # Check that we can distinguish names from strings in literal collections, e.g. lists. # The list has to have more than 4 items to get accumulated in a collection a = ["y", 'Exception', "x", Exception, "z"] -assert a[1] == "Exception" -assert a[3] == Exception + +assert_equal(a[1], "Exception") +assert_equal(a[3], Exception) diff --git a/uncompyle6/semantics/n_actions.py b/uncompyle6/semantics/n_actions.py index 54a160ba..44cf12c7 100644 --- a/uncompyle6/semantics/n_actions.py +++ b/uncompyle6/semantics/n_actions.py @@ -1,4 +1,4 @@ -# Copyright (c) 2022 by Rocky Bernstein +# Copyright (c) 2022-2023 by Rocky Bernstein # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -159,7 +159,7 @@ class NonterminalActions: # * class_name - the name of the class # * subclass_info - the parameters to the class e.g. # class Foo(bar, baz) - # ----------- + # ------------ # * subclass_code - the code for the subclass body if node == "classdefdeco2": @@ -181,7 +181,7 @@ class NonterminalActions: subclass_code = build_class[-3][1].attr class_name = node[0][0].pattr else: - raise "Internal Error n_classdef: cannot find class name" + raise RuntimeError("Internal Error n_classdef: cannot find class name") if node == "classdefdeco2": self.write("\n") @@ -228,7 +228,8 @@ class NonterminalActions: else: # from trepan.api import debug; debug() raise TypeError( - f"Internal Error: n_const_list expects dict, list set, or set; got {lastnodetype}" + ("Internal Error: n_const_list expects dict, list set, or set; got " + f"{lastnodetype}") ) self.indent_more(INDENT_PER_LEVEL) @@ -267,7 +268,7 @@ class NonterminalActions: if elem == "add_value": elem = elem[0] if elem == "ADD_VALUE": - if self.version[0] == 2: + if self.version < (3, 0, 0): value = "%r" % elem.pattr else: value = "%s" % elem.pattr