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.

Author p-ganssle
Recipients p-ganssle
Date 2020-12-16.15:59:27
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1608134368.02.0.941471966425.issue42660@roundup.psfhosted.org>
In-reply-to
Content
This is a code style issue — in https://github.com/python/cpython/pull/23614, a regression was deliberately introduced to satisfy an overzealous compiler. The `day` variable has logical bounds `0 <= day <= 6`. In the original code, both sides of this boundary condition were explicitly checked (since this logically documents the bounds of the variable).

Some compilers complain about checking `day < 0`, because `day` is an unsigned type. It is not an immutable fact that `day` will always be an unsigned type, and implicitly relying on this fact makes the code both less readable and more fragile. This was changed over my objections and despite the fact that I had a less fragile solution available that also satisfied the overzealous compiler.

In the short term, my preferred solution would be to add in a static assertion that `day` is an unsigned type — this does not have to work on every platform, it simply needs to serve as a notification to make the code less fragile and to document our assumptions to both readers and the compiler.

In the long term, I think we need a way to solve the problem that it is apparently not possible to disable any compiler warnings even if they don't apply to the situation!
History
Date User Action Args
2020-12-16 15:59:28p-gansslesetrecipients: + p-ganssle
2020-12-16 15:59:28p-gansslesetmessageid: <1608134368.02.0.941471966425.issue42660@roundup.psfhosted.org>
2020-12-16 15:59:28p-gansslelinkissue42660 messages
2020-12-16 15:59:27p-gansslecreate