Skip to content

Commit 348a9d4

Browse files
authored
Track tuples in memprofile (#8943)
1 parent c796a56 commit 348a9d4

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

mypy/memprofile.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,16 @@ def collect_memory_stats() -> Tuple[Dict[str, int],
4040
if isinstance(x, list):
4141
# Keep track of which node a list is associated with.
4242
inferred[id(x)] = '%s (list)' % n
43+
if isinstance(x, tuple):
44+
# Keep track of which node a list is associated with.
45+
inferred[id(x)] = '%s (tuple)' % n
4346

4447
for k in get_class_descriptors(type(obj)):
4548
x = getattr(obj, k, None)
4649
if isinstance(x, list):
4750
inferred[id(x)] = '%s (list)' % n
51+
if isinstance(x, tuple):
52+
inferred[id(x)] = '%s (tuple)' % n
4853

4954
freqs = {} # type: Dict[str, int]
5055
memuse = {} # type: Dict[str, int]

0 commit comments

Comments
 (0)