[issue1712522] urllib.quote throws exception on Unicode URL

Senthil Kumaran report at bugs.python.org
Mon Jul 19 18:59:24 CEST 2010


Senthil Kumaran <orsenthil at gmail.com> added the comment:

There are two points here:

First, is it a desired behavior of quote function in 2.7?

IMO, it is. In the discussions of issue3300, I think, it was decided that quote handling of unicode strings may be backported. Behaviour wise the modified version still returns a string which is correct for py2.

The forward compatibility on 2.7.1 version here is on the basis that someone in 2.7 might be relying on Exception raised for Unicode string "for the quote function".
 
But my guess is, when they are trying to quote non-ascii characters using quote function which is path component, they might be expecting that it gives them a correct output and this (now) modified function would be of help.

Of the many cases we have on Unicode being auto-coerced to 8-bit string, this particular case of using UTF-8 as default encoding for Unicode and returning a string seems to be fine (again discussed in the earlier issue). We might not have good answers for many other cases.

The Second point, as this is leading to an API change we should not have it 2.7.1

It would be unfortunate, if we revert the patch on this account only. 

This can be classified a bug-fix producing the desirable behavior, just that it needs the API to change too. I don't know if we have never adopted this approach (of changing API in backward compatible manner) for anything other than the security bug fixes alone.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue1712522>
_______________________________________


More information about the Python-bugs-list mailing list