Géry <gery.o...@gmail.com> added the comment:

@nicktimko Thanks for the historical track.

Here is a patch that solves this issue by updating the `urlsplit` and 
`urlunsplit` functions of the `urllib.parse` module to keep the '?' and '#' 
delimiters in URIs if present, even if their associated component is empty, as 
required by RFC 3986: https://github.com/python/cpython/pull/15642

That way we get the correct behavior:

    >>> import urllib.parse
    >>> urllib.parse.urlunsplit(urllib.parse.urlsplit("http://example.com/?";))
    'http://example.com/?'
    >>> urllib.parse.urlunsplit(urllib.parse.urlsplit("http://example.com/#";))
    'http://example.com/#'

Any feedback welcome.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue37969>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to