Skip to content

Commit 386a0bf

Browse files
committed
Bug fixes
1 parent 925a587 commit 386a0bf

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

memory_profiler.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -985,8 +985,9 @@ def profile(func=None, stream=None, precision=1, backend='psutil'):
985985
"""
986986
Decorator that will run the function and print a line-by-line profile
987987
"""
988-
if backend == 'tracemalloc' and not tracemalloc.is_tracing():
989-
tracemalloc.start()
988+
if backend == 'tracemalloc' and has_tracemalloc:
989+
if not tracemalloc.is_tracing():
990+
tracemalloc.start()
990991
if func is not None:
991992
def wrapper(*args, **kwargs):
992993
prof = LineProfiler(backend=backend)

0 commit comments

Comments
 (0)