py-sdl / py-sdl2

Python ctypes wrapper around SDL2
Other
296 stars 49 forks source link

Fix SDL_TICKS_PASSED (#234) #235

Closed benrg closed 2 years ago

benrg commented 2 years ago

PR Description

SDL_TICKS_PASSED is meant to compare 32-bit tick counts in a way that works correctly when the counter has recently wrapped around. The Python implementation just did a straight integer comparison. Fix it and add a regression test.

Merge Checklist

a-hurst commented 2 years ago

@benrg Thanks so much for this! Not sure why a few of the the CI tests are failing/segfaulting since this doesn't change anything ctypes-related. I'll take a quick look, but since it doesn't seem likely the fix here is the culprit I'll probably just merge this and try to figure it out later.

a-hurst commented 2 years ago

@benrg Sorry for the delay! Real life and work have been getting in the way of side-projects this month. From what I can tell the segfaults are being caused elsewhere and are just exacerbated somehow by the added test. Since your code isn't at fault I'm just going to merge and sort it out from there. Thanks again for the fix!