A RetroSearch Logo

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

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2009-March/087276.html below:

accept unicode for 'c' and byte for 'C' in getarg?

[Python-Dev] py3k: accept unicode for 'c' and byte for 'C' in getarg? [Python-Dev] py3k: accept unicode for 'c' and byte for 'C' in getarg?Victor Stinner victor.stinner at haypocalc.com
Tue Mar 17 14:00:14 CET 2009
Le Tuesday 17 March 2009 13:52:16 Victor Stinner, vous avez écrit :
> I realised with the issue #3446 that getarg('c') (get a byte) accepts not
> only a byte string of 1 byte, but also an unicode string of 1 character (if
> the character code is in [0; 255]). I don't think that it's a good idea to
> accept unicode here. Example: b"x".center(5, "\xe9") should be a TypeError.
>
> The "C" format (get a character) has the opposite problem: it accepts both
> byte and unicode, whereas byte should be rejected. Example:
> mmap.write_byte('é') should be a TypeError.

I opened an issue (with a patch) for my request:
   http://bugs.python.org/issue5499

Note: except of the bytes.{center,ljust,rjust} tests, all other tests are ok. 
It should not break the standard library, but maybe 3rd party library.

-- 
Victor Stinner aka haypo
http://www.haypocalc.com/blog/
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