On Thu, Sep 16, 2010 at 06:28, Nick Coghlan <ncogh...@gmail.com> wrote: > On Thu, Sep 16, 2010 at 10:26 PM, Antoine Pitrou <solip...@pitrou.net> wrote: >> Why won't you feel confident? Are there any specific issues (apart from >> the lack of a WSGI PEP)? >> If they are technical problems, they should be reported on the bug >> tracker. >> If they are representational, cultural or psychological issues, I'm >> not sure what we can do. But delaying the release won't solve them. > > There are some APIs that should be able to handle bytes *or* strings, > but the current use of string literals in their implementation means > that bytes don't work. This turns out to be a PITA for some networking > related code which really wants to be working with raw bytes (e.g. > URLs coming off the wire). > > For example: > >>>> import urllib.parse as parse >>>> parse.urlsplit("http://www.ubuntu.com") > SplitResult(scheme='http', netloc='www.ubuntu.com', path='', query='', > fragment='') >>>> parse.urlsplit(b"http://www.ubuntu.com") > Traceback (most recent call last): > File "<stdin>", line 1, in <module> > File "/home/ncoghlan/devel/py3k/Lib/urllib/parse.py", line 178, in urlsplit > i = url.find(':') > TypeError: expected an object with the buffer interface > > There's no real reason urlsplit (and similar urllib.parse APIs) > shouldn't support bytes, but the internal use of string literals > currently prevents it. > > We don't seem to have created a tracker issue from the discussion back > in June where this came up, so I went ahead and created one just now: > http://bugs.python.org/issue9873
When I do my two months of PSF-sponsored core work (expected to be Jan/Feb) I was planning on (finally) redoing the dev docs, writing a HOWTO for maintaining a Python 2/3 code base, and cleaning up the test suite. But I am starting to think I should change the last one to solving this polymorphism problem in a way that can be applied across the board in the stdlib. > > I think there were other APIs mentioned back then beyond the > urllib.parse ones, but I didn't find them when I went trawling through > the list archives yesterday. If anyone else thinks of any APIs that > should allow bytes as well as strings (or vice-versa) feel free to add > them to that issue. Or create separate issues and make them dependencies for issue9873. _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com