[stdlib-sig] urllib.parrrrse does not supporrrrt bytes

Armin Ronacher armin.ronacher at active-4.com
Sun Sep 20 20:48:04 CEST 2009


Hi,

Antoine Pitrou schrieb:
> Can you please precise what you are trying to do?
> 
> If you just want to replace the implementation without changing the API
> to support bytes, I'm not sure what the point is.
What I'm trying to do and the point of my changes is support for bytes.
 A feature that disappared in Python 3.0 and is widely used.


Problems I've seen in the code so far that go beyond the point of what I
intend to change:

unused and undocumented interfaces:

- urllib.parse.unwrap     not sure what that is for, I guess testing
- urllib.parse.to_bytes   also unused, I guess it was in use for an
                          older implementation
- urllib.parse.test and
  urllib.parse.test_data  unused test suite that is also in the real
                          test suite.  Can we delete it?

It's also pretty inconsistent currently:

urllib.parse.quote and urllib.parse.quote_plus already work with bytes
(the code adds explicit byte support, one just calls into
urllib.parse.quote_from_bytes).  However the reverse functions do not
work with bytes at all.

What is quote_from_bytes used for when quote just calls into it?  Why
did this ever become a public interface?  Also once unquote and
unquote_plus are fixed, unquote_to_bytes is similarly useless,
especially because both of them perform some weird utf-8 conversion if
non-bytes are passed to them.

I would just fix those and deprecate the explicit unquote_to_bytes and
quote_from_bytes for future versions of Python 3.

Any comments on that?


Regards,
Armin


More information about the stdlib-sig mailing list