Vajrasky Kok added the comment: I modified the patch to handle the last case using your way as well.
Anyway, I found out that urlsplit and urlparse got the same issue as well. >>> urlparse('python.org', b'http://') Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/home/sky/Code/python/programming_language/cpython/Lib/urllib/parse.py", line 292, in urlparse url, scheme, _coerce_result = _coerce_args(url, scheme) File "/home/sky/Code/python/programming_language/cpython/Lib/urllib/parse.py", line 109, in _coerce_args raise TypeError("Cannot mix str and non-str arguments") TypeError: Cannot mix str and non-str arguments >>> urlparse('python.org', b'') ParseResult(scheme=b'', netloc='', path='python.org', params='', query='', fragment='') >>> urlparse('python.org', 0) ParseResult(scheme=0, netloc='', path='python.org', params='', query='', fragment='') Same thing happens in urlsplit. Fortunately, urlunsplit and urlunparse don't have this issue. ---------- Added file: http://bugs.python.org/file31889/urljoin_throws_type_error_v2.patch _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue19094> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com