A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/2006-July/067474.html below:

[Python-Dev] urllib.quote and unicode bug resuscitation attempt

[Python-Dev] urllib.quote and unicode bug resuscitation attemptMike Brown mike at skew.org
Sat Jul 15 22:27:15 CEST 2006
Stefan Rank wrote:
> Well, originally, I would have expected it to return a byte str(ing),

I'd assume unicode in, unicode out, and str in, str out, but since it's
always going to produce ASCII-range characters, it wouldn't matter.
Moot point anyway.

> BUT
> I am now converted and think it is best to raise a TypeError for 
> unicode, and leave the encoding decisions to higher level code.
> 
> So I'll repeat the "patch" #1, slightly modified::
> 
>   if isinstance(s, unicode):
>       raise TypeError("quote expects an encoded byte string as argument")
> 
> Is it safe to assume that code that breaks because of this change was 
> already broken?

Yes. The patch seems fine to me, although maybe

if not isinstance(s, str)

would be better?
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4