This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author hfuru
Recipients eric.araujo, eric.smith, hfuru, ncoghlan, orsenthil, pitrou, r.david.murray, sjt, vstinner
Date 2010-11-09.10:37:26
SpamBayes Score 0.002122521
Marked as misclassified No
Message-id <1289299049.91.0.838429042617.issue9873@psf.upfronthosting.co.za>
In-reply-to
Content
urlunparse(url or params = bytes object) produces a result
with the repr of the bytes object if params is set.

urllib.parse.urlunparse(['http', 'host', '/dir', b'params', '', ''])
--> "http://host/dir;b'params'"

That's confusing since urllib/parse.py goes to a lot of trouble to
support both bytes and str.  Simplest fix is to only accept str:

Index: Lib/urllib/parse.py
@@ -219,5 +219,5 @@ def urlunparse(components):
     scheme, netloc, url, params, query, fragment = components
     if params:
-        url = "%s;%s" % (url, params)
+        url = ';'.join((url, params))
     return urlunsplit((scheme, netloc, url, query, fragment))
 
Some people at comp.lang.python tell me code shouldn't anyway do str()
just in case it is needed like urllib does, not that I can make much
sense of that discussion.  (Subject: harmful str(bytes)).

BTW, the str vs bytes code doesn't have to be quite as painful as in
urllib.parse.  Here is a patch which just rearranges and factors out
some code.
   http://bugs.python.org/file19525/parse.diff
History
Date User Action Args
2010-11-09 10:37:30hfurusetrecipients: + hfuru, ncoghlan, orsenthil, pitrou, vstinner, eric.smith, eric.araujo, r.david.murray, sjt
2010-11-09 10:37:29hfurusetmessageid: <1289299049.91.0.838429042617.issue9873@psf.upfronthosting.co.za>
2010-11-09 10:37:27hfurulinkissue9873 messages
2010-11-09 10:37:26hfurucreate