cpython: 8625ce7da152 (original) (raw)

--- a/Lib/netrc.py +++ b/Lib/netrc.py @@ -2,7 +2,7 @@

Module and documentation by Eric S. Raymond, 21 Dec 1998

-import os, shlex +import io, os, shlex all = ["netrc", "NetrcParseError"] @@ -37,12 +37,14 @@ class netrc: lexer.commenters = lexer.commenters.replace('#', '') while 1: # Look for a machine, default, or macdef top-level keyword

@@ -68,8 +70,8 @@ class netrc: self.hosts[entryname] = {} while 1: tt = lexer.get_token()

--- a/Lib/test/test_netrc.py +++ b/Lib/test/test_netrc.py @@ -1,54 +1,107 @@ - -import netrc, os, unittest, sys +import netrc, os, unittest, sys, textwrap from test import support -TEST_NETRC = """ -

-#this is a comment -# this is a comment - -machine foo login log1 password pass1 account acct1 -machine bar login log1 password pass# account acct1 - -macdef macro1 -line1 -line2 - -macdef macro2 -line3 -line4 - -default login log2 password pass2 - -""" - temp_filename = support.TESTFN class NetrcTestCase(unittest.TestCase):

- def tearDown(self): os.unlink(temp_filename)

+

def test_macros(self):

+

+

+

+

+

+

+

+

+

+

+

+ def test_main(): support.run_unittest(NetrcTestCase)

--- a/Misc/ACKS +++ b/Misc/ACKS @@ -564,6 +564,7 @@ Paul Moore Derek Morr James A Morrison Mher Movsisyan +Ruslan Mstoi Sjoerd Mullender Sape Mullender Michael Muller

--- a/Misc/NEWS +++ b/Misc/NEWS @@ -7,6 +7,11 @@ What's New in Python 3.1.4? Release date: 2011-05-XX +Library +------- + +- Issue #12009: Fixed regression in netrc file comment handling. + Extension Modules -----------------