Commit 97ccc3f
committed
Fix tracemalloc.Snapshot.filter_traces() for tuple traces storage
Snapshot.filter_traces() assumed the internal traces container supports .copy(),
which fails if a Snapshot is constructed with tuple traces.
Fix: use list(self.traces._traces) in the no-filter branch to make a shallow copy
without depending on the container type.
Add a regression test that constructs a Snapshot with tuple storage and verifies
filter_traces(()) works.
Signed-off-by: Yongtao Huang <yongtaoh2022@gmail.com>1 parent 5989095 commit 97ccc3f
2 files changed
+8
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
446 | 446 | | |
447 | 447 | | |
448 | 448 | | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
449 | 456 | | |
450 | 457 | | |
451 | 458 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
471 | 471 | | |
472 | 472 | | |
473 | 473 | | |
474 | | - | |
| 474 | + | |
475 | 475 | | |
476 | 476 | | |
477 | 477 | | |
| |||
0 commit comments