Patch # 1331 by Christian Heimes.

The patch fixes some of the problems on Windows. It doesn't introduce
addition problems on Linux.
This commit is contained in:
Guido van Rossum 2007-10-26 04:29:23 +00:00
parent daa251ca09
commit c12a813aa7
7 changed files with 25 additions and 15 deletions

View file

@ -26,9 +26,12 @@ class netrc:
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: