Bugs in long-literal handlin

Move n_dict to n_actions and special case n_const_list.
Generalize build_collection out of 3.7+ and into all Pythons
This commit is contained in:
rocky
2022-04-24 17:02:05 -04:00
parent 371138cfbc
commit 8cdf741b62
6 changed files with 304 additions and 256 deletions

View File

@@ -1306,7 +1306,7 @@ assert tuple(x.keys()) == (1, 3)
# Try a long dictionary.
# This should not be slow as it has been in the past
values = {
"valuea": a + 1,
"value1": x,
"value2": 2 + 1,
"value3": 3 + 1,
"value4": 4 + 1,
@@ -1811,3 +1811,46 @@ values = {
}
assert list(values.values()) == list(range(2, 502 + 2))
# Try a long dictionary that fails because we have a binary op.
# We can get a expr32 grouping speedup
# which is slower than if this were all constant.
# The above was not implemented at the time this test was written.
values = {
"value1": x + 1, # This is a binary op not consant
"value2": 2,
"value3": 3,
"value4": 4,
"value5": 5,
"value6": 6,
"value7": 7,
"value8": 8,
"value9": 9,
"value10": 10,
"value11": 11,
"value12": 12,
"value13": 13,
"value14": 14,
"value15": 15,
"value16": 16,
"value17": 17,
"value18": 18,
"value19": 19,
"value20": 20,
"value21": 21,
"value22": 22,
"value23": 23,
"value24": 24,
"value25": 25,
"value26": 26,
"value27": 27,
"value28": 28,
"value29": 29,
"value30": 30,
"value31": 31,
"value32": 32,
"value33": 33,
}
assert list(values.values()) == list(range(2, 502 + 2))