[issue9873] Allow bytes in some APIs that use string literals internally

STINNER Victor report at bugs.python.org
Thu Sep 30 12:59:31 CEST 2010


STINNER Victor <victor.stinner at haypocalc.com> added the comment:

> Option 2 (the alternative Antoine suggested and I'm considering):
> - "decode" ... to str ...
> - ... objects are "encoded" back to actual bytes before 
>   they are returned

In this case, you have to be very careful to not mix str and bytes decoded to str using a pseudo-encoding. Dummy example: urljoin('unicode', b'bytes') should raise an error.

I don't care of the internals if you write tests to ensure that it is not possible to mix str and bytes with the public API.

----------

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


More information about the Python-bugs-list mailing list