Skip to content

Commit

Permalink
Reject --tracemalloc in pyperf command
Browse files Browse the repository at this point in the history
  • Loading branch information
oraluben committed May 23, 2022
1 parent 968f247 commit ef3f4cd
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
1 change: 0 additions & 1 deletion TODO.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ BUGS
====

* Repair PyPy on Travis
* Reject --tracemalloc in bench_command()
* BUG: "python pyperf timeit --compare-to=pypy" doesn't tune correctly the runner
for pypy. pypy requires more warmup values (10) than cpython (1).
* BUG: --duplicate of timeit must be ignored in PyPy, see the discussion
Expand Down
1 change: 1 addition & 0 deletions pyperf/_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ def __init__(self, runner, name, command):

def compute(self):
WorkerTask.compute(self)
assert not self.args.tracemalloc
if self.args.track_memory:
value = self.metadata.pop('command_max_rss', None)
if not value:
Expand Down
11 changes: 7 additions & 4 deletions pyperf/_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,10 +305,13 @@ def _process_args_impl(self):
self._only_in_worker("--worker-task")

if args.tracemalloc:
try:
import tracemalloc # noqa
except ImportError as exc:
raise CLIError("fail to import tracemalloc: %s" % exc)
if args.action == 'command':
raise CLIError('--tracemalloc cannot be used with pyperf command')
else:
try:
import tracemalloc # noqa
except ImportError as exc:
raise CLIError("fail to import tracemalloc: %s" % exc)

if args.track_memory:
if MS_WINDOWS:
Expand Down

0 comments on commit ef3f4cd

Please sign in to comment.