Skip to content

Replace _PyUnicode_AsString and PYWIN_ATTR_CONVERT with PyUnicode_AsUTF8#2591

Open
Avasam wants to merge 6 commits intomhammond:mainfrom
Avasam:Replace-_PyUnicode_AsString-with-PyUnicode_AsUTF8
Open

Replace _PyUnicode_AsString and PYWIN_ATTR_CONVERT with PyUnicode_AsUTF8#2591
Avasam wants to merge 6 commits intomhammond:mainfrom
Avasam:Replace-_PyUnicode_AsString-with-PyUnicode_AsUTF8

Conversation

@Avasam
Copy link
Collaborator

@Avasam Avasam commented Apr 30, 2025

Addresses a Python C API Deprecation listed in #2588

_PyUnicode_AsString is now just a wrapper around PyUnicode_AsUTF8
https://github.com/python/cpython/blob/4e294f6feb3193854d23e0e8be487213a80b232f/Include/cpython/unicodeobject.h#L632-L637

PYWIN_ATTR_CONVERT hasn't been a meaningful alias since 7cab372#diff-7b12f2f5988484bf0eb2709398c8e2b2ff828cad5aa35b8ed44f8942bd7438ffL94-L98 other than for making name name public. Which it now is with PyUnicode_AsUTF8.

It was also hiding a cast from char* to const char*.

@Avasam Avasam mentioned this pull request Apr 30, 2025
7 tasks
@Avasam Avasam force-pushed the Replace-_PyUnicode_AsString-with-PyUnicode_AsUTF8 branch 2 times, most recently from 13ac4bd to 5083fc7 Compare April 30, 2025 02:33
@Avasam Avasam force-pushed the Replace-_PyUnicode_AsString-with-PyUnicode_AsUTF8 branch 3 times, most recently from d49fa0b to 4b48e5b Compare April 30, 2025 04:14
@Avasam Avasam force-pushed the Replace-_PyUnicode_AsString-with-PyUnicode_AsUTF8 branch from 4b48e5b to 5bcbf7f Compare April 30, 2025 23:10
@Avasam Avasam requested a review from mhammond May 30, 2025 18:59
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.

1 participant