[issue12009] netrc module crashes if netrc file has comment lines

Benjamin Peterson report at bugs.python.org
Fri Jun 10 01:46:21 CEST 2011


Benjamin Peterson <benjamin at python.org> added the comment:

I'd like to see this go in.

+                # seek to the beginning of the comment, then skip the line.
+                pos = len(tt) + 1
+                lexer.instream.seek(-pos, 1)
+                lexer.instream.readline()

Can't you just lexer.instream.readline()?

+        if sys.platform != 'cygwin':
+            mode += 't'

Perhaps this deserves a comment.

+        self.assertEqual({'macro1': ['line1\n', 'line2\n'],
+                          'macro2': ['line3\n', 'line4\n']}, nrc.macros)

It's preferable that the literals are the second argument to assertEqual.

+        self.assertEqual(('bar', None, passwd), nrc.hosts['foo.domain.com'])
+        self.assertEqual(('foo', None, 'pass'), nrc.hosts['bar.domain.com'])
+

Here too.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue12009>
_______________________________________


More information about the Python-bugs-list mailing list