Executor: prevent logging of AST representation
Building the AST representation is potentially expensive, thus we only
build it, if the necessary log level is set.
See
@@ -129,6 +129,7 @@ class MonkeyTypeExecutor(AbstractExecutor):
def _execute_ast_nodes(self):
for node in self._ast_nodes:
try:
+ if self._logger.isEnabledFor(logging.DEBUG):
self._logger.debug("Executing %s", astor.to_source(node))
code = compile(self.wrap_node_in_module(node), "<ast>", "exec")
sys.setprofile(self._tracer)
