Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions Lib/test/test_tracemalloc.py
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,13 @@ def test_filter_traces(self):

self.assertRaises(TypeError, snapshot.filter_traces, filter1)

def test_filter_traces_no_filter_tuple_storage(self):
snapshot, _snapshot2 = create_snapshots()
snap = tracemalloc.Snapshot(tuple(snapshot.traces._traces),
snapshot.traceback_limit)
snap2 = snap.filter_traces(())
self.assertEqual(snap2.traces._traces, list(snap.traces._traces))

def test_filter_traces_domain(self):
snapshot, snapshot2 = create_snapshots()
filter1 = tracemalloc.Filter(False, "a.py", domain=1)
Expand Down
2 changes: 1 addition & 1 deletion Lib/tracemalloc.py
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ def filter_traces(self, filters):
exclude_filters,
trace)]
else:
new_traces = self.traces._traces.copy()
new_traces = list(self.traces._traces)
return Snapshot(new_traces, self.traceback_limit)

def _group_by(self, key_type, cumulative):
Expand Down
Loading