-
-
Notifications
You must be signed in to change notification settings - Fork 31.9k
Fix compiler warnings in _zoneinfo.c #20342
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
pablogsal
commented
May 24, 2020
•
edited
Loading
edited
913b482
to
9faef06
Compare
Changed also all |
Hummm, there are still some places where there may be loss of data:
but these require possible changes in |
I am really not a fan of this. These are blighted unsigned values, there is no reason to use signed data types for this. |
Yeah, I can see that. How do you want to proceed? There is still some mismatch with the precision of some of these types. I lack context on many of these so maybe is better to scope this PR on the ssize_t -> Py_ssize_t and you could fix the others in a separate one? |
@pablogsal Yeah, I'm comfortable with changing We can look at the |
@pganssle Ok, if I not mistaken this PR should contain what you proposed. Could you please check if everything is ok with you? |
@pablogsal So I created this equivalent PR on the backport, which in some ways addresses the "loss of precision" issues. I'm not sure, can we disable the error on the That said, we can change the error check to also raise with |
I would prefer to discuss that in a different PR as potentially involves reorganising some of the code (although the most likely outcome is suppressing the error). |
OK, do you want to comment on the backport PR? I'm planning to fix both at once in the backport. |
I believe this solves https://bugs.python.org/issue40686, correct? |
Yeah it should. Btw I would like to have the same code for the fix as the backport so we can keep those in sync. I will update this PR shortly |
@pganssle I have updated the PR with the latest changes in your backport |
@pablogsal: Status check is done, and it's a success ✅ . |
Thanks @pablogsal for the PR 🌮🎉.. I'm working now to backport this PR to: 3.9. |
GH-20467 is a backport of this pull request to the 3.9 branch. |
``` D:\a\cpython\cpython\Modules\_zoneinfo.c(903,52): warning C4267: '=': conversion from 'size_t' to 'unsigned int', possible loss of data [D:\a\cpython\cpython\PCbuild\_zoneinfo.vcxproj] D:\a\cpython\cpython\Modules\_zoneinfo.c(904,44): warning C4267: '=': conversion from 'size_t' to 'unsigned int', possible loss of data [D:\a\cpython\cpython\PCbuild\_zoneinfo.vcxproj] D:\a\cpython\cpython\Modules\_zoneinfo.c(1772,31): warning C4244: '=': conversion from 'ssize_t' to 'uint8_t', possible loss of data [D:\a\cpython\cpython\PCbuild\_zoneinfo.vcxproj] ``` (cherry picked from commit e4799b9) Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>