Skip to content

Commit ead0e8b

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

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
@@ -1638,6 +1638,16 @@ def iter_frames(frames=frames):
16381638
f"You passed in an explicit {save_count=} which is being "
16391639
f"ignored in favor of {frames=}."
16401640
)
1641+
if self._save_count is None and cache_frame_data:
1642+
_api.warn_external(
1643+
f"{frames=!r} which we can infer the length of, "
1644+
"did not pass an explicit *save_count* "
1645+
f"and passed {cache_frame_data=}. To avoid a possibly "
1646+
"unbounded cache, frame data caching has been disabled. "
1647+
"To suppress this warning either pass "
1648+
"`cache_frame_data=False` or `save_count=MAX_FRAMES`."
1649+
)
1650+
cache_frame_data = False
16411651

16421652
self._cache_frame_data = cache_frame_data
16431653

0 commit comments

Comments
 (0)