You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-03 00:45:53 +08:00
3.7+ "or" handling in listcomp
This commit is contained in:
@@ -23,6 +23,17 @@ def columnize(l):
|
||||
if not isinstance(l[i], str)]
|
||||
assert [0, 2] == columnize([1, 'a', 2])
|
||||
|
||||
# From 3.7.6 _collections_abc.py
|
||||
# Bug was handling "or" in listcomp
|
||||
def count(values, x):
|
||||
return sum(1 for v in values if v or x)
|
||||
|
||||
assert count([2, 2], False) == 2
|
||||
assert count([], False) == 0
|
||||
assert count([], True) == 0
|
||||
assert count([2], True) == 1
|
||||
assert count([0], False) == 0
|
||||
|
||||
# From 3.7 test_generators
|
||||
# Bug was in handling the way list_if is optimized in 3.7+;
|
||||
# We need list_if37 and compare_chained37.
|
||||
|
Reference in New Issue
Block a user