Skip to content

Commit 419fbe5

Browse files
Fix new code and tests.
1 parent 79f5a02 commit 419fbe5

File tree

3 files changed

+5
-8
lines changed

3 files changed

+5
-8
lines changed

Lib/test/test_urlparse.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,7 @@ def test_urljoins(self):
581581
self.checkJoin('a', 'b', 'b')
582582

583583
# Test with empty (but defined) components.
584-
self.checkJoin(RFC1808_BASE, '', 'http://a/b/c/d;p?q#f')
584+
self.checkJoin(RFC1808_BASE, '', 'http://a/b/c/d;p?q')
585585
self.checkJoin(RFC1808_BASE, '#', 'http://a/b/c/d;p?q#', relroundtrip=False)
586586
self.checkJoin(RFC1808_BASE, '#z', 'http://a/b/c/d;p?q#z')
587587
self.checkJoin(RFC1808_BASE, '?', 'http://a/b/c/d;p?', relroundtrip=False)
@@ -592,7 +592,7 @@ def test_urljoins(self):
592592
self.checkJoin(RFC1808_BASE, ';#z', 'http://a/b/c/;#z')
593593
self.checkJoin(RFC1808_BASE, ';x', 'http://a/b/c/;x')
594594
self.checkJoin(RFC1808_BASE, '/w', 'http://a/w')
595-
self.checkJoin(RFC1808_BASE, '//', 'http://a/b/c/d;p?q#f')
595+
self.checkJoin(RFC1808_BASE, '//', 'http://a/b/c/d;p?q')
596596
self.checkJoin(RFC1808_BASE, '//#z', 'http://a/b/c/d;p?q#z')
597597
self.checkJoin(RFC1808_BASE, '//?y', 'http://a/b/c/d;p?y')
598598
self.checkJoin(RFC1808_BASE, '//;x', 'http://;x')
@@ -601,7 +601,7 @@ def test_urljoins(self):
601601
# For backward compatibility with RFC1630, the scheme name is allowed
602602
# to be present in a relative reference if it is the same as the base
603603
# URI scheme.
604-
self.checkJoin(RFC1808_BASE, 'http:', 'http://a/b/c/d;p?q#f')
604+
self.checkJoin(RFC1808_BASE, 'http:', 'http://a/b/c/d;p?q')
605605
self.checkJoin(RFC1808_BASE, 'http:#', 'http://a/b/c/d;p?q#', relroundtrip=False)
606606
self.checkJoin(RFC1808_BASE, 'http:#z', 'http://a/b/c/d;p?q#z')
607607
self.checkJoin(RFC1808_BASE, 'http:?', 'http://a/b/c/d;p?', relroundtrip=False)
@@ -612,7 +612,7 @@ def test_urljoins(self):
612612
self.checkJoin(RFC1808_BASE, 'http:;#z', 'http://a/b/c/;#z')
613613
self.checkJoin(RFC1808_BASE, 'http:;x', 'http://a/b/c/;x')
614614
self.checkJoin(RFC1808_BASE, 'http:/w', 'http://a/w')
615-
self.checkJoin(RFC1808_BASE, 'http://', 'http://a/b/c/d;p?q#f')
615+
self.checkJoin(RFC1808_BASE, 'http://', 'http://a/b/c/d;p?q')
616616
self.checkJoin(RFC1808_BASE, 'http://#z', 'http://a/b/c/d;p?q#z')
617617
self.checkJoin(RFC1808_BASE, 'http://?y', 'http://a/b/c/d;p?y')
618618
self.checkJoin(RFC1808_BASE, 'http://;x', 'http://;x')

Lib/urllib/parse.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -587,8 +587,6 @@ def urljoin(base, url, allow_fragments=True):
587587
path = bpath
588588
if query is None:
589589
query = bquery
590-
if fragment is None:
591-
fragment = bfragment
592590
return _coerce_result(_urlunsplit(scheme, netloc, path,
593591
query, fragment))
594592

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
Fix ``urllib.parse.urljoin``.
2-
In RFC 3986, ``base``'s fragment is always discarded.
1+
The fragment of the base URI is now always discarded in :func:`urllib.parse.urljoin` in accordance to :rfc:`3986`.

0 commit comments

Comments
 (0)