Skip to content

gh-105156: Cleanup usage of old Py_UNICODE type #105158

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

Merged
merged 2 commits into from
Jun 1, 2023

Conversation

vstinner
Copy link
Member

@vstinner vstinner commented May 31, 2023

  • refcounts.dat:

    • Remove Py_UNICODE functions
    • Replace Py_UNICODE argument type with wchar_t
  • _PyUnicode_ToLowercase(), _PyUnicode_ToUppercase(), _PyUnicode_ToTitlecase() are no longer deprecate in comment. It's no longer needed since they now use Py_UCS4 type, rather than the deprecated Py_UNICODE type.

  • gdb: Remove unused char_width() method.


📚 Documentation preview 📚: https://cpython-previews--105158.org.readthedocs.build/

* refcounts.dat:

  * Remove Py_UNICODE functions
  * Replace Py_UNICODE argument type with wchar_t

* _PyUnicode_ToLowercase(), _PyUnicode_ToUppercase(),
  _PyUnicode_ToTitlecase() are no longer deprecate in comment.
  It's no longer needed since they now use Py_UCS4 type, rather than
  the deprecated Py_UNICODE type.
* gdb: Remove unused char_width() method.
@vstinner
Copy link
Member Author

cc @methane


# Convert the int code points to unicode characters, and generate a
# local unicode instance.
result = u''.join(map(chr, Py_UNICODEs))
result = u''.join(map(chr, characters))
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
result = u''.join(map(chr, characters))
result = ''.join(map(chr, characters))

Copy link
Member Author

Choose a reason for hiding this comment

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

Removing supporting for Python 2 require way more changes. I prefer to restrict changes to just Py_UNICODE here.

Copy link
Member

Choose a reason for hiding this comment

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

FYI, I removed Python 2 support from libpython.py already.
https://github.com/python/cpython/pull/31717/files

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh I didn't know. Well, feel free to remove that u prefix in a separated PR :-) My PR doesn't add it at least :-)

@vstinner vstinner enabled auto-merge (squash) June 1, 2023 07:15
@vstinner vstinner merged commit 7d07e58 into python:main Jun 1, 2023
@vstinner vstinner deleted the cleanup_py_unicode branch June 1, 2023 07:18
@vstinner
Copy link
Member Author

vstinner commented Jun 1, 2023

Merged. Thanks for your review @methane.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants