Skip to content

Commit 3faea8a

Browse files
authored
include io and max_iterations
1 parent ea08ce8 commit 3faea8a

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
@@ -15,6 +15,7 @@
1515
import linecache
1616
import logging
1717
import os
18+
import io
1819
import pdb
1920
import subprocess
2021
import sys
@@ -1110,7 +1111,7 @@ def memit(self, line='', cell=None):
11101111
counter += 1
11111112
tmp = memory_usage((_func_exec, (stmt, self.shell.user_ns)),
11121113
timeout=timeout, interval=interval,
1113-
max_usage=True,
1114+
max_usage=True, max_iterations=1,
11141115
include_children=include_children)
11151116
mem_usage.append(tmp)
11161117

@@ -1246,7 +1247,7 @@ def exec_with_profiler(filename, profiler, backend, passed_args=[]):
12461247
try:
12471248
if _backend == 'tracemalloc' and has_tracemalloc:
12481249
tracemalloc.start()
1249-
with open(filename, encoding='utf-8') as f:
1250+
with io.open(filename, encoding='utf-8') as f:
12501251
exec(compile(f.read(), filename, 'exec'), ns, ns)
12511252
finally:
12521253
if has_tracemalloc and tracemalloc.is_tracing():

0 commit comments

Comments
 (0)