Issue 5499: only accept byte for getarg('c') and unicode for getarg('C') (original) (raw)

Issue5499

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), .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:46 admin set github: 49749
2009-04-02 08:23:07 vstinner set messages: +
2009-04-02 00:34:27 benjamin.peterson set status: open -> closednosy: + benjamin.petersonmessages: + resolution: accepted
2009-04-01 23:08:56 gregory.p.smith set nosy: + gregory.p.smithmessages: +
2009-03-31 19:25:08 ocean-city set messages: +
2009-03-31 19:24:15 ocean-city set priority: release blocker
2009-03-31 19:23:46 ocean-city link issue5410 dependencies
2009-03-31 19:23:27 ocean-city link issue5391 dependencies
2009-03-17 19:45:09 ocean-city set nosy: + ocean-city
2009-03-17 17:25:17 vstinner set messages: +
2009-03-17 12:58:17 vstinner create