diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2014-03-10 10:05:07 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2014-03-10 10:05:07 (GMT) |
commit | 8ce8ff9ac77bdf202bf39bb98203d26cd40d8e04 (patch) | |
tree | e2f8e55269f18537de0a621742b4cd2f56522e78 /Lib/tracemalloc.py | |
parent | bcfcfc51f89e67f8cc890984f4f4054532706841 (diff) | |
download | cpython-8ce8ff9ac77bdf202bf39bb98203d26cd40d8e04.zip cpython-8ce8ff9ac77bdf202bf39bb98203d26cd40d8e04.tar.gz cpython-8ce8ff9ac77bdf202bf39bb98203d26cd40d8e04.tar.bz2 |
tracemalloc: filter_traces() raises a TypeError if filters is not an iterable
Diffstat (limited to 'Lib/tracemalloc.py')
-rw-r--r-- | Lib/tracemalloc.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Lib/tracemalloc.py b/Lib/tracemalloc.py index f117127..adedfc5 100644 --- a/Lib/tracemalloc.py +++ b/Lib/tracemalloc.py @@ -1,4 +1,4 @@ -from collections import Sequence +from collections import Sequence, Iterable from functools import total_ordering import fnmatch import linecache @@ -382,6 +382,9 @@ class Snapshot: is a list of Filter instances. If filters is an empty list, return a new Snapshot instance with a copy of the traces. """ + if not isinstance(filters, Iterable): + raise TypeError("filters must be a list of filters, not %s" + % type(filters).__name__) if filters: include_filters = [] exclude_filters = [] |