Skip to content

Comments

Python 3.12 Unicode API#22

Merged
zsedem merged 2 commits intozsedem:mainfrom
sheepforce:python3.12
Jul 8, 2024
Merged

Python 3.12 Unicode API#22
zsedem merged 2 commits intozsedem:mainfrom
sheepforce:python3.12

Conversation

@sheepforce
Copy link

@sheepforce sheepforce commented Jul 8, 2024

After we've reenabled cpython for Python >= 3.8 in #21 , Python 3.12 deprecated the Unicode API (https://docs.python.org/3.11/c-api/unicode.html#c.PyUnicode_FromUnicode and https://docs.python.org/3.11/c-api/unicode.html#c.PyUnicode_AsUnicode) and CPython failed to build, consequently. This PR ports the relevant functions to the new C-API, namely using CWchar (https://docs.python.org/3.11/c-api/unicode.html#c.PyUnicode_AsWideChar and https://docs.python.org/3.11/c-api/unicode.html#c.PyUnicode_FromWideChar). This allows a uniform handling of the platform specific casts using C Wide Strings from base without preprocessor stuff.

It would be great if we could have a new hackage release with those changes 🐑

@sheepforce sheepforce changed the title Python3.12 Python 3.12 Unicode API Jul 8, 2024
@zsedem zsedem merged commit a756d77 into zsedem:main Jul 8, 2024
@zsedem
Copy link
Owner

zsedem commented Jul 8, 2024

Thanks for the contribution

sternenseemann pushed a commit to NixOS/nixpkgs that referenced this pull request Jul 15, 2024
With the cpython 3.9.0 release, the breaking changes in the C-API for python's unicode are handeled correctly via an upstream fix, see zsedem/haskell-cpython#22
flandweber pushed a commit to flandweber/nixpkgs that referenced this pull request Aug 28, 2024
With the cpython 3.9.0 release, the breaking changes in the C-API for python's unicode are handeled correctly via an upstream fix, see zsedem/haskell-cpython#22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants