From 594f0bbaa34d2435f2ccbdfd61dc598c5e99fc74 Mon Sep 17 00:00:00 2001 From: Antony Lee Date: Wed, 12 May 2021 13:43:54 +0200 Subject: [PATCH] Deprecate cbook.report_memory. It's unrelated to Matplotlib's functionality, and more importantly it likely never worked on Py3 (currently raising "'int' object has no attribute 'split'") because the subprocess needs to be called with `universal_newlines=True`, otherwise (currently) stdout is returned as bytes and indexing that gives an int, not a str... --- doc/api/next_api_changes/deprecations/20209-AL.rst | 3 +++ lib/matplotlib/cbook/__init__.py | 1 + 2 files changed, 4 insertions(+) create mode 100644 doc/api/next_api_changes/deprecations/20209-AL.rst diff --git a/doc/api/next_api_changes/deprecations/20209-AL.rst b/doc/api/next_api_changes/deprecations/20209-AL.rst new file mode 100644 index 000000000000..79c462cd048f --- /dev/null +++ b/doc/api/next_api_changes/deprecations/20209-AL.rst @@ -0,0 +1,3 @@ +``cbook.report_memory`` +~~~~~~~~~~~~~~~~~~~~~~~ +... is deprecated. Use ``psutil.virtual_memory`` instead. diff --git a/lib/matplotlib/cbook/__init__.py b/lib/matplotlib/cbook/__init__.py index 3e0d0062dd03..c8070e2b4ec8 100644 --- a/lib/matplotlib/cbook/__init__.py +++ b/lib/matplotlib/cbook/__init__.py @@ -628,6 +628,7 @@ def remove(self, o): self.push(elem) +@_api.deprecated("3.5", alternative="psutil.virtual_memory") def report_memory(i=0): # argument may go away """Return the memory consumed by the process.""" def call(command, os_name):