class tracemalloc.Filter(inclusive: bool, filename_pattern: str, lineno: int=None, all_frames: bool=False)
Filter on traces of memory blocks.
See the fnmatch.fnmatch() function for the syntax of filename_pattern. The '.pyc' file extension is replaced with '.py'.
Examples:
-
Filter(True, subprocess.__file__)only includes traces of thesubprocessmodule -
Filter(False, tracemalloc.__file__)excludes traces of thetracemallocmodule -
Filter(False, "<unknown>")excludes empty tracebacks
Changed in version 3.5: The '.pyo' file extension is no longer replaced with '.py'.
-
inclusive -
If inclusive is
True(include), only trace memory blocks allocated in a file with a name matchingfilename_patternat line numberlineno.If inclusive is
False(exclude), ignore memory blocks allocated in a file with a name matchingfilename_patternat line numberlineno.
-
lineno -
Line number (
int) of the filter. If lineno isNone, the filter matches any line number.
-
filename_pattern -
Filename pattern of the filter (
str).
-
all_frames -
If all_frames is
True, all frames of the traceback are checked. If all_frames isFalse, only the most recent frame is checked.This attribute has no effect if the traceback limit is
1. See theget_traceback_limit()function andSnapshot.traceback_limitattribute.
Please login to continue.