Skip to content

Replace _PyUnicode_AsString and PYWIN_ATTR_CONVERT with PyUnicode_AsUTF8 #2591

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

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
Comment on lines 106 to 107
// nongame applications, such as movie playback (DirectShow�), when the user wants to hear the soundtrack while
// typing in Microsoft Word or Microsoft� Excel, for example. However, if the user switches to another DirectSound
// nongame applications, such as movie playback (DirectShow�), when the user wants to hear the soundtrack while
// typing in Microsoft Word or Microsoft� Excel, for example. However, if the user switches to another DirectSound
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Gosh darn it XD
#2496

@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
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