Message401020
I agree, including use of hex, if possible, for unsigned (non-negative) values.
Grepping 'format requires' returns
F:\dev\3x\Modules\_struct.c: 365: "'%c' format requires 0 <= number <= %zu",
F:\dev\3x\Modules\_struct.c: 371: "'%c' format requires %zd <= number <= %zd",
F:\dev\3x\Modules\_struct.c: 550: "byte format requires -128 <= number <= 127");
F:\dev\3x\Modules\_struct.c: 565: "ubyte format requires 0 <= number <= 255");
F:\dev\3x\Modules\_struct.c: 577: "char format requires a bytes object of length 1");
F:\dev\3x\Modules\_struct.c: 593: "short format requires " Py_STRINGIFY(SHRT_MIN)
F:\dev\3x\Modules\_struct.c: 611: "ushort format requires 0 <= number <= "
Py_STRINGIFY(USHRT_MAX));
I believe l365 is the source for the 2nd example. AFAIK, 'zu' is not valid for either C printf or Python % formating.
Lines 611 and 612 are the source for the 1st example. From comments before line 365, there can be issues with lefts shifts, but '0xffff', '0xffff_ffff', and '0xffff_ffff_ffff_ffff' could be hard-coded strings that would cover all 'normal' systems.
Grepping "argument out of range" returns
F:\dev\3x\Modules\_struct.c: 168: "argument out of range");
F:\dev\3x\Modules\_struct.c: 192: "argument out of range");
F:\dev\3x\Modules\_struct.c: 215: "argument out of range");
F:\dev\3x\Modules\_struct.c: 238: "argument out of range");
F:\dev\3x\Modules\_struct.c: 261: "argument out of range");
F:\dev\3x\Modules\_struct.c: 284: "argument out of range");
It is nnclear to me without more reading why some codes lead to this less helpful message. |
|
Date |
User |
Action |
Args |
2021-09-04 00:27:10 | terry.reedy | set | recipients:
+ terry.reedy, steven.daprano |
2021-09-04 00:27:10 | terry.reedy | set | messageid: <1630715230.48.0.150516535695.issue45034@roundup.psfhosted.org> |
2021-09-04 00:27:10 | terry.reedy | link | issue45034 messages |
2021-09-04 00:27:10 | terry.reedy | create | |
|