Skip to content

Commit 1ecaf4e

Browse files
committed
Unpacking return value if max_usage is True
If the memory_usage function is called with (callable, arglist, kwargs), as target and max_usage is True, the function now returns a number instead of a list with one entry.
1 parent cedd238 commit 1ecaf4e

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

memory_profiler.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,8 @@ def memory_usage(proc=-1, interval=.1, timeout=None, timestamps=False,
339339
n_measurements = parent_conn.recv()
340340
if retval:
341341
ret = ret, returned
342+
if max_usage:
343+
ret = ret[0]
342344
except Exception:
343345
parent = psutil.Process(os.getpid())
344346
for child in parent.children(recursive=True):

0 commit comments

Comments
 (0)