[Python-Dev] (Not) delaying the 3.2 release

Nick Coghlan ncoghlan at gmail.com
Thu Sep 16 15:28:22 CEST 2010

On Thu, Sep 16, 2010 at 10:26 PM, Antoine Pitrou <solipsis at 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='',
>>> 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:

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.


Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia

More information about the Python-Dev mailing list