Skip to content

Commit 1974456

Browse files
jacobtylerwallsPierre-Sassoulas
authored andcommitted
efficiency
1 parent 0486eda commit 1974456

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

astroid/manager.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -191,17 +191,15 @@ def ast_from_module_name(self, modname, context_file=None):
191191
modname=modname,
192192
path=found_spec.location,
193193
) from e
194-
if stderr.getvalue():
194+
stderr_value = stderr.getvalue()
195+
if stderr_value:
195196
logger.error(
196-
"Captured stderr from importing %s:\n%s",
197-
modname,
198-
stderr.getvalue(),
197+
"Captured stderr from importing %s:\n%s", modname, stderr_value
199198
)
200-
if stdout.getvalue():
199+
stdout_value = stdout.getvalue()
200+
if stdout_value:
201201
logger.info(
202-
"Captured stdout from importing %s:\n%s",
203-
modname,
204-
stdout.getvalue(),
202+
"Captured stdout from importing %s:\n%s", modname, stdout_value
205203
)
206204

207205
return self.ast_from_module(module, modname)

0 commit comments

Comments
 (0)