Skip to content

Commit 2f650a6

Browse files
authored
Merge pull request #451 from andrem-eberle/master
Tentative fix for #439
2 parents 3d5e220 + 4d420e2 commit 2f650a6

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed
114 Bytes
Binary file not shown.

test/simple_source/expression/05_long_literals.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -725,3 +725,10 @@
725725
}
726726

727727
assert sorted(values.values())[1:] == list(range(2, 34))
728+
729+
730+
# Check that we can distinguish names from strings in literal collections, e.g. lists.
731+
# The list has to have more than 4 items to get accumulated in a collection
732+
a = ["y", 'Exception', "x", Exception, "z"]
733+
assert a[1] == "Exception"
734+
assert a[3] == Exception

uncompyle6/scanner.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -171,11 +171,11 @@ def bound_collection_from_tokens(
171171
has_extended_arg=False,
172172
)
173173
)
174-
if tokens[j] == "LOAD_CONST":
175-
opname = "ADD_VALUE"
176-
else:
177-
opname = "ADD_VALUE_VAR"
178174
for j in range(collection_start, i):
175+
if tokens[j] == "LOAD_CONST":
176+
opname = "ADD_VALUE"
177+
else:
178+
opname = "ADD_VALUE_VAR"
179179
new_tokens.append(
180180
Token(
181181
opname=opname,

0 commit comments

Comments
 (0)