Paul Ganssle <p.gans...@gmail.com> added the comment:

As I mentioned, it's a style issue. Yes this did not introduce any 
user-observable bugs, nor should it have changed the machine code emitted by 
the assembly on any competent compiler.

The issue is that I had deliberately chosen to do a "redundant" check to 
improve the readability and to be robust against someone saying, "Why is this a 
unit8_t instead of an int? I don't think it makes anything faster..." or some 
other justification for changing all the uint8_t fields to ints.

Previous to this, we had something where the compiler would fix any bugs caused 
by that by itself by emitting an additional bounds check. In my proposed fix to 
the compiler warnings, there was a static assertion where the machine would 
alert us if the situation changed. The problem is that we now have a 
non-machine-checked comment for something that would be difficult to issue 
tests for.

Frankly, I think that even the worst case scenario here isn't that bad — TZif 
files malformed in a very specific way would be accepted as valid. As it's 
coded now, this would probably just lead to a crash later, or possibly some 
weird results in time zone math. Still, I think we need a solution to this 
problem because our blind adherence to an invalid compiler warning is leading 
us to write more fragile code, whic h is especially problematic in C, which is 
notoriously dangerous and problematic to write.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue42660>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to