Skip to content

Commit f61af67

Browse files
committed
make compatible with python 2.6
1 parent 9f4fc07 commit f61af67

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

memory_profiler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1077,7 +1077,7 @@ def choose_backend(new_backend=None):
10771077
('tracemalloc', has_tracemalloc),
10781078
('no_backend', True)
10791079
]
1080-
backends_indices = {b[0]: i for i, b in enumerate(all_backends)}
1080+
backends_indices = dict((b[0], i) for i, b in enumerate(all_backends))
10811081

10821082
if new_backend is not None:
10831083
all_backends.insert(0, all_backends.pop(backends_indices[new_backend]))

test/test_gen.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ def my_func():
1010
@profile
1111
def test_comprehension():
1212
# Dict comprehension
13-
d_comp = {str(k*k): [v] * (1<<17)
14-
for (v, k) in enumerate(range(99, 111))}
13+
d_comp = dict((str(k*k), [v] * (1<<17))
14+
for (v, k) in enumerate(range(99, 111)))
1515

1616
# List comprehension
1717
l_comp = [[i] * (i<<9) for i in range(99)]
@@ -20,7 +20,7 @@ def test_comprehension():
2020

2121
def hh(x=1):
2222
# Set comprehension
23-
s_comp = {('Z',) * (k<<13) for k in range(x, 19 + 2*x)}
23+
s_comp = set(('Z',) * (k<<13) for k in range(x, 19 + 2*x))
2424
return s_comp
2525

2626
val = [range(1, 4), max(1, 4), 42 + len(hh())]

0 commit comments

Comments
 (0)