pytroll / aggdraw

Python package wrapping AGG2 drawing functionality
https://aggdraw.readthedocs.io/en/latest/
Other
98 stars 48 forks source link

Fix Python 3.12 compatibility #90

Closed djhoese closed 8 months ago

djhoese commented 8 months ago

@mraspaud I'm going to merge and release this as a patch release so I can get Python 3.12 wheels out and get conda-forge moving on their Python 3.12 migration. BUT please review this and sanity check it. I don't think there are any unexpected memory allocations based on the API (be careful when reviewing that you look at both 3.11 and 3.12 API docs). I could have used PyUnicode_ReadChar as an alternative but it wasn't clear to me from the docs what it does in the error case:

https://docs.python.org/3.12/c-api/unicode.html#c.PyUnicode_ReadChar

Additionally, this whole bit of code seems fishy as we're kind of playing with casting of 32-bit and possibly 64-bit types and assigning one to the other. It apparently kind of worked already so :man_shrugging: