changeset: 95683:fc0e79387a3a user: Berker Peksag date: Thu Apr 16 02:31:14 2015 +0300 files: Lib/test/test_urlparse.py Lib/urllib/parse.py Misc/NEWS description: Issue #23703: Fix a regression in urljoin() introduced in 901e4e52b20a. Patch by Demian Brecht. diff -r 132b5376bf34 -r fc0e79387a3a Lib/test/test_urlparse.py --- a/Lib/test/test_urlparse.py Wed Apr 15 18:06:05 2015 -0400 +++ b/Lib/test/test_urlparse.py Thu Apr 16 02:31:14 2015 +0300 @@ -391,6 +391,9 @@ self.checkJoin('http://a/b/c/d/e/', '../../f/g', 'http://a/b/c/f/g') self.checkJoin('http://a/b/', '../../f/g/', 'http://a/f/g/') + # issue 23703: don't duplicate filename + self.checkJoin('a', 'b', 'b') + def test_RFC2732(self): str_cases = [ ('http://Test.python.org:5432/foo/', 'test.python.org', 5432), diff -r 132b5376bf34 -r fc0e79387a3a Lib/urllib/parse.py --- a/Lib/urllib/parse.py Wed Apr 15 18:06:05 2015 -0400 +++ b/Lib/urllib/parse.py Thu Apr 16 02:31:14 2015 +0300 @@ -447,8 +447,7 @@ segments = base_parts + path.split('/') # filter out elements that would cause redundant slashes on re-joining # the resolved_path - segments = segments[0:1] + [ - s for s in segments[1:-1] if len(s) > 0] + segments[-1:] + segments[1:-1] = filter(None, segments[1:-1]) resolved_path = [] diff -r 132b5376bf34 -r fc0e79387a3a Misc/NEWS --- a/Misc/NEWS Wed Apr 15 18:06:05 2015 -0400 +++ b/Misc/NEWS Thu Apr 16 02:31:14 2015 +0300 @@ -36,6 +36,9 @@ Library ------- +- Issue #23703: Fix a regression in urljoin() introduced in 901e4e52b20a. + Patch by Demian Brecht. + - Issue #4254: Adds _curses.update_lines_cols() Patch by Arnon Yaari - Issue 19933: Provide default argument for ndigits in round. Patch by