[issue35377] urlsplit scheme argument broken

2018-12-03 Thread devkral
devkral added the comment: ah, I get the idea behind urlunsplit. But still: for e.g. http, http:/// is invalid. These urls are invalid for e.g. requests. May I ask: urllib.parse is for web protocol urls? If yes, then there should be an option which defaults to my version. --

[issue35377] urlsplit scheme argument broken

2018-12-03 Thread Steven D'Aprano
Steven D'Aprano added the comment: You haven't given a convincing reason that there is a problem that needs fixing, or if there is, that your patch is the right way to fix it. You have already pointed out that there is at least one scheme where :/// is part of a valid URL: "file:///". Where

[issue35377] urlsplit scheme argument broken

2018-12-03 Thread Roundup Robot
Change by Roundup Robot : -- keywords: +patch pull_requests: +10097 stage: -> patch review ___ Python tracker ___ ___

[issue35377] urlsplit scheme argument broken

2018-12-03 Thread devkral
devkral added the comment: Ok, then the problem is in unsplit. Because: :/// is not a valid url. Next try: in urlunsplit: if netloc or (scheme and scheme in uses_netloc and url[:2] != '//'): if url and url[:1] != '/' and scheme in ("file", ""): # my change url = '/' + url

[issue35377] urlsplit scheme argument broken

2018-12-02 Thread Steven D'Aprano
Steven D'Aprano added the comment: I don't think this is broken, but I do think it could be documented better. You have to read the documentation for `urlparse` to see this: [Quote] Following the syntax specifications in RFC 1808, urlparse recognizes a netloc only if it is properly

[issue35377] urlsplit scheme argument broken

2018-12-02 Thread devkral
devkral added the comment: first a correction; there is one protocol where it make sense: file I would change: ... elif scheme: ... to ... elif scheme and scheme != "file": ... Second: no it is not a correct behaviour. Urlunsplit is supposed to create a valid url from a tuple created by

[issue35377] urlsplit scheme argument broken

2018-12-02 Thread SilentGhost
SilentGhost added the comment: While it might seem broken, it behaves according to documentation, it seems to me. -- nosy: +SilentGhost, orsenthil type: -> behavior ___ Python tracker

[issue35377] urlsplit scheme argument broken

2018-12-02 Thread devkral
New submission from devkral : the scheme argument of urlsplit/urlparse is completely broken. here two examples: urlunsplit(urlsplit("httpbin.org", scheme="https://;)) 'https://:httpbin.org' urlunsplit(urlsplit("httpbin.org", scheme="https")) 'https:///httpbin.org' Fix: change urlsplit logic