Skip to content
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

Refactored test from #3989 to work correctly and also apply to #4191 and fixed the bug being tested #4215

Merged
merged 3 commits into from
Apr 27, 2024

Conversation

dillon-duff
Copy link

Fixed overflow bug in src_c/draw.c:draw_fillpoly from #4191 by changing y, miny, maxy, x1, y1, x2, y2 from int type to double. Uncommented and refactored a test that was previously meant to test the same bug

fixes #4191
fixes #3989

Fixed overflow bug in src_c/draw.c:draw_fillpoly from pygame#4191 by changing y, miny, maxy, x1, y1, x2, y2 from int type to double
@illume
Copy link
Member

illume commented Apr 26, 2024

Hi,

I have warnings as errors on CI.

There's some warnings as errors here: https://ci.appveyor.com/project/pygame/pygame/builds/49689982/job/m6kny35txym1rm4q#L792

src_c/draw.c(2359): error C2220: warning treated as error - no 'object' file generated
src_c/draw.c(2359): warning C4244: 'function': conversion from 'double' to 'int', possible loss of data
src_c/draw.c(2405): warning C4244: 'function': conversion from 'double' to 'int', possible loss of data
src_c/draw.c(2424): warning C4244: 'function': conversion from 'double' to 'int', possible loss of data

You could try adding an explicit cast to int (if it makes sense), and that should take care of the warnings.

@illume
Copy link
Member

illume commented Apr 27, 2024

Cool, it looks like that warning issue is fixed.

Seems there's a clang-format issue left.

We recently started using pre-commit tool to check things before committing. https://pre-commit.com/#install

python -m pip install pre-commit
pre-commit install
pre-commit run --all-files

After you pre-commit install, it will run the checks at commit time. So the pre-commit run --all-files is not necessary.

@illume illume added bug draw pygame.draw labels Apr 27, 2024
Copy link
Member

@illume illume left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉🎈 thanks

@illume illume merged commit 7a1a2c5 into pygame:main Apr 27, 2024
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug draw pygame.draw
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug about pygame.draw.polygon() pygame.draw.polygon() not working properly with large coordinates
3 participants