[issue45034] Improve struct.pack out of range error messages

2021-09-07 Thread Mark Dickinson
Mark Dickinson added the comment: The out-of-range error messages for unsigned short and short have been fixed, thanks to Nikita Sobolev. They resulted from a rather odd use of the Py_STRINGIFY macro, which meant that not only were the messages obscure, but they differed from system to syste

[issue45034] Improve struct.pack out of range error messages

2021-09-07 Thread Mark Dickinson
Mark Dickinson added the comment: New changeset 8ca6b61e3fd7f1e2876126cee82da8d812c8462f by Nikita Sobolev in branch 'main': bpo-45034: Fix how upper limit is formatted for `struct.pack("H", ...)` (GH-28178) https://github.com/python/cpython/commit/8ca6b61e3fd7f1e2876126cee82da8d812c8462f

[issue45034] Improve struct.pack out of range error messages

2021-09-05 Thread Nikita Sobolev
Change by Nikita Sobolev : -- keywords: +patch pull_requests: +26605 stage: -> patch review pull_request: https://github.com/python/cpython/pull/28178 ___ Python tracker ___ _

[issue45034] Improve struct.pack out of range error messages

2021-09-04 Thread Terry J. Reedy
Terry J. Reedy added the comment: Go ahead, with the understanding that there is no guaranteed acceptance of the change, even with a good patch. There may be reasons for the status quo that neither Steven nor I are aware of. I don't think that either of the listed experts, added as nosy, a

[issue45034] Improve struct.pack out of range error messages

2021-09-04 Thread Nikita Sobolev
Nikita Sobolev added the comment: I would like to work on this if nobody else has already started :) -- nosy: +sobolevn ___ Python tracker ___

[issue45034] Improve struct.pack out of range error messages

2021-09-04 Thread Dong-hee Na
Change by Dong-hee Na : -- nosy: +corona10 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.pytho

[issue45034] Improve struct.pack out of range error messages

2021-09-03 Thread Terry J. Reedy
Terry J. Reedy added the comment: 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' for

[issue45034] Improve struct.pack out of range error messages

2021-08-27 Thread Steven D'Aprano
New submission from Steven D'Aprano : Packing errors using struct in 3.9 seem to be unnecessarily obfuscated to me. >>> import struct >>> struct.pack('H', 7) Traceback (most recent call last): File "", line 1, in struct.error: ushort format requires 0 <= number <= (0x