mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-04-18 08:00:16 +00:00
Tweaks to long-literal handling...
* Use version tuple comparison for version testing * small lintin of n_actions * revise test so assert is not removed in 3.8
This commit is contained in:
parent
6f3fe06594
commit
c01ab5e001
Binary file not shown.
@ -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)
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user