This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: only accept byte for getarg('c') and unicode for getarg('C')
Type: Stage:
Components: Versions: Python 3.1
process
Status: closed Resolution: accepted
Dependencies: Superseder:
Assigned To: Nosy List: benjamin.peterson, gregory.p.smith, ocean-city, vstinner
Priority: release blocker Keywords: patch

Created on 2009-03-17 12:58 by vstinner, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
getarg_strict_char.patch vstinner, 2009-03-17 12:58
Messages (6)
msg83676 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2009-03-17 12:58
To avoid byte/character mixture, getarg('c') must only accept a byte 
string of 1 byte and getarg('C') only an unicode string of 1 
character.

Impacted methods:
- datetime.datetime.isoformat(sep), array.array(type, data): don't 
accept byte anymore
- msvcrt.putch(char), msvcrt.ungetch(char), <mmap 
object>.write_byte(char): don't accept unicode anymore

I tried runtests.sh: only the 3 bytes.{center,ljust,rjust} tests have 
to be changed, all other tests are ok.

Related issues: #3446, #5391.
msg83687 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2009-03-17 17:25
unicode methods center(), ljust(), rjust() use a callback (convert_uc) 
to get an unicode character (unicode string of 1 character). If 'C' is 
fixed, convert_uc() callback can be removed.
msg84874 - (view) Author: Hirokazu Yamamoto (ocean-city) * (Python committer) Date: 2009-03-31 19:25
Note: #5391 and #5410 are depends on this issue.
msg85112 - (view) Author: Gregory P. Smith (gregory.p.smith) * (Python committer) Date: 2009-04-01 23:08
good catch.  the patch looks correct to me.
msg85124 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2009-04-02 00:34
Fixed in r71013.
msg85181 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2009-04-02 08:23
Ooops, I read converterr("a unicode character", ...), but it should be 
converterr("an unicode character", ...) ;-)

Thanks benjamin.peterson, it will help other issues like #5391 and 
#5410.
History
Date User Action Args
2022-04-11 14:56:46adminsetgithub: 49749
2009-04-02 08:23:07vstinnersetmessages: + msg85181
2009-04-02 00:34:27benjamin.petersonsetstatus: open -> closed

nosy: + benjamin.peterson
messages: + msg85124

resolution: accepted
2009-04-01 23:08:56gregory.p.smithsetnosy: + gregory.p.smith
messages: + msg85112
2009-03-31 19:25:08ocean-citysetmessages: + msg84874
2009-03-31 19:24:15ocean-citysetpriority: release blocker
2009-03-31 19:23:46ocean-citylinkissue5410 dependencies
2009-03-31 19:23:27ocean-citylinkissue5391 dependencies
2009-03-17 19:45:09ocean-citysetnosy: + ocean-city
2009-03-17 17:25:17vstinnersetmessages: + msg83687
2009-03-17 12:58:17vstinnercreate