Skip to content

Commit 4a26881

Browse files
committed
FIX _backend_chosen variable deleted from everywhere
1 parent 636b344 commit 4a26881

1 file changed

Lines changed: 3 additions & 6 deletions

File tree

memory_profiler.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ def memory_usage(proc=-1, interval=.1, timeout=None, timestamps=False,
262262
ret : return value of the profiled function
263263
Only returned if retval is set to True
264264
"""
265-
if not _backend_chosen:
265+
if _backend is None:
266266
choose_backend()
267267
if stream is not None:
268268
timestamps = True
@@ -952,9 +952,8 @@ def memit(self, line='', cell=None):
952952
if mem_usage:
953953
print(result)
954954
else:
955-
print(
956-
'ERROR: could not read memory usage, try with a lower interval '
957-
'or more iterations')
955+
print('ERROR: could not read memory usage, try with a '
956+
'lower interval or more iterations')
958957

959958
if return_result:
960959
return result
@@ -1050,8 +1049,6 @@ def move_to_start(d, key):
10501049
if _backend != new_backend and new_backend is not None:
10511050
print('{0} can not be used, {1} used instead'.format(new_backend,
10521051
_backend))
1053-
global _backend_chosen
1054-
_backend_chosen = True
10551052

10561053

10571054
# Insert in the built-ins to have profile

0 commit comments

Comments
 (0)