diff options
Diffstat (limited to 'pylint/graph.py')
-rw-r--r-- | pylint/graph.py | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/pylint/graph.py b/pylint/graph.py index 88095cb0d..3c4bbcef1 100644 --- a/pylint/graph.py +++ b/pylint/graph.py @@ -105,9 +105,8 @@ class DotBackend: os.close(pdot) else: dot_sourcepath = outputfile - pdot = codecs.open(dot_sourcepath, "w", encoding="utf8") # type: ignore - pdot.write(self.source) # type: ignore - pdot.close() # type: ignore + with codecs.open(dot_sourcepath, "w", encoding="utf8") as pdot: # type: ignore + pdot.write(self.source) # type: ignore if target not in graphviz_extensions: if shutil.which(self.renderer) is None: raise RuntimeError( |