Skip to content

Commit dabd667

Browse files
committed
MNT: add warning if we disable cache_frame_data
This prevents a possible run-away unbounded cache!
1 parent 96fcb93 commit dabd667

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

lib/matplotlib/animation.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1668,6 +1668,16 @@ def iter_frames(frames=frames):
16681668
f"You passed in an explicit {save_count=} which is being "
16691669
f"ignored in favor of {frames=}."
16701670
)
1671+
if self._save_count is None and cache_frame_data:
1672+
_api.warn_external(
1673+
f"{frames=!r} which we can infer the length of, "
1674+
"did not pass an explicit *save_count* "
1675+
f"and passed {cache_frame_data=}. To avoid a possibly "
1676+
"unbounded cache, frame data caching has been disabled. "
1677+
"To suppress this warning either pass "
1678+
"`cache_frame_data=False` or `save_count=MAX_FRAMES`."
1679+
)
1680+
cache_frame_data = False
16711681

16721682
self._cache_frame_data = cache_frame_data
16731683

0 commit comments

Comments
 (0)