summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorAndrew M. Kuchling <amk@amk.ca>2002-03-22 02:46:41 (GMT)
committerAndrew M. Kuchling <amk@amk.ca>2002-03-22 02:46:41 (GMT)
commit366a1df7f1a940a77d2d3b8ac6425fe7353f43c6 (patch)
treeda4f41086450cc49f25f8d00b4847ad7e1ed5479 /Lib
parent83d042d3a7fbae3133462abf641f1a0e0fe23d4c (diff)
downloadcpython-366a1df7f1a940a77d2d3b8ac6425fe7353f43c6.zip
cpython-366a1df7f1a940a77d2d3b8ac6425fe7353f43c6.tar.gz
cpython-366a1df7f1a940a77d2d3b8ac6425fe7353f43c6.tar.bz2
[Bug #532115] netrc module was broken
* 'macdef' (macro definition) wasn't parsed correctly * account value not reset for a subsequent 'default' line * typo: 'whitepace' -> 'whitespace' Bugfix candidate.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/netrc.py20
1 files changed, 9 insertions, 11 deletions
diff --git a/Lib/netrc.py b/Lib/netrc.py
index b78d4d8..b6907d95 100644
--- a/Lib/netrc.py
+++ b/Lib/netrc.py
@@ -44,28 +44,26 @@ class netrc:
elif tt == 'macdef': # Just skip to end of macdefs
entryname = lexer.get_token()
self.macros[entryname] = []
- lexer.whitepace = ' \t'
+ lexer.whitespace = ' \t'
while 1:
line = lexer.instream.readline()
- if not line or line == '\012' and tt == '\012':
- lexer.whitepace = ' \t\r\n'
+ if not line or line == '\012':
+ lexer.whitespace = ' \t\r\n'
break
- tt = line
self.macros[entryname].append(line)
+ continue
else:
raise NetrcParseError(
"bad toplevel token %r" % tt, file, lexer.lineno)
# We're looking at start of an entry for a named machine or default.
- if toplevel == 'machine':
- login = account = password = None
- self.hosts[entryname] = {}
+ login = account = password = None
+ self.hosts[entryname] = {}
while 1:
tt = lexer.get_token()
- if tt=='' or tt == 'machine' or tt == 'default' or tt == 'macdef':
- if toplevel == 'macdef':
- break
- elif login and password:
+ if (tt=='' or tt == 'machine' or
+ tt == 'default' or tt =='macdef'):
+ if login and password:
self.hosts[entryname] = (login, account, password)
lexer.push_token(tt)
break