Fix compiler warnings in MSVC for winreg.c #24441
Conversation
I think this warrants a skip news and skip issue, I separated this from #24440 because maybe this needs a backport while that one doesn't. |
Thanks! I'll do an auto backport and see how far it goes, but it's not essential. |
28873a7
into
python:master
Thanks @Fidget-Spinner for the PR, and @zooba for merging it |
Sorry, @Fidget-Spinner and @zooba, I could not cleanly backport this to |
Sorry @Fidget-Spinner and @zooba, I had trouble checking out the |
Didn't backport cleanly, so we'll just leave it. |
During compilation, I get a warning:
1>\Documents\GitHub\cpython\PC\winreg.c(683,21): warning C4018: '<': signed/unsigned mismatch
.Caused by the line
assert(len < size);
becauselen
is typePy_ssize_t
(signed) andsize
is typeDWORD
(unsigned).We can cast len to
unsigned
safely to silence the warning (which is what the compiler already does implicitly), because there is already a check forassert(len >= 0);
above.