Diff of /Lib/netrc.py [13921f] .. [e6e3a0]  Maximize  Restore

Switch to side-by-side view

--- a/Lib/netrc.py
+++ b/Lib/netrc.py
@@ -26,9 +26,12 @@
                 file = os.path.join(os.environ['HOME'], ".netrc")
             except KeyError:
                 raise IOError("Could not find .netrc: $HOME is not set")
-        fp = open(file)
         self.hosts = {}
         self.macros = {}
+        with open(file) as fp:
+            self._parse(file, fp)
+
+    def _parse(self, file, fp):
         lexer = shlex.shlex(fp)
         lexer.wordchars += r"""!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~"""
         while 1:

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks