Skip to content

C API: Deprecate Py_UNICODE type #105156

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

Closed
vstinner opened this issue May 31, 2023 · 0 comments
Closed

C API: Deprecate Py_UNICODE type #105156

vstinner opened this issue May 31, 2023 · 0 comments
Labels
type-bug An unexpected behavior, bug, or error

Comments

@vstinner
Copy link
Member

vstinner commented May 31, 2023

Python 3.12 removed the last batch of C functions related to the old Py_UNICODE type. But the type itself is still part of the C API. It is still used in some area of the Python code base where the wchar_t type should be used instead.

I propose to deprecate the Py_UNICODE type and schedule its removal in Python 3.15. This type should not be used since Python 3.3: PEP 393.

Linked PRs

@vstinner vstinner added the type-bug An unexpected behavior, bug, or error label May 31, 2023
vstinner added a commit to vstinner/cpython that referenced this issue May 31, 2023
Deprecate the old Py_UNICODE and PY_UNICODE_TYPE types in the C API:
use wchar_t instead.

Replace Py_UNICODE with wchar_t in multiple C files.
vstinner added a commit to vstinner/cpython that referenced this issue 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.
vstinner added a commit to vstinner/cpython that referenced this issue May 31, 2023
Argument Clinic now uses "const wchar_t*" type instead of
"const Py_UNICODE*" type for the "Py_UNICODE" format.
vstinner added a commit to vstinner/cpython that referenced this issue May 31, 2023
Argument Clinic now uses "const wchar_t*" type instead of
"const Py_UNICODE*" type for the "Py_UNICODE" format.
vstinner added a commit that referenced this issue May 31, 2023
Argument Clinic now uses "const wchar_t*" type instead of
"const Py_UNICODE*" type for the "Py_UNICODE" format.
vstinner added a commit that referenced this issue Jun 1, 2023
Deprecate the old Py_UNICODE and PY_UNICODE_TYPE types in the C API:
use wchar_t instead.

Replace Py_UNICODE with wchar_t in multiple C files.

Co-authored-by: Inada Naoki <songofacandy@gmail.com>
vstinner added a commit that referenced this issue Jun 1, 2023
* refcounts.dat:

  * Remove Py_UNICODE functions.
  * Replace Py_UNICODE argument type with wchar_t.

* _PyUnicode_ToLowercase(), _PyUnicode_ToUppercase(),
  _PyUnicode_ToTitlecase() are no longer deprecated in comments.
  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 vstinner closed this as completed Jun 1, 2023
vstinner added a commit to vstinner/cpython that referenced this issue Jun 1, 2023
Update Lib/test/clinic.test for updated Py_UNICODE converter: it now
uses wchar_t type rather than Py_UNICODE.
vstinner added a commit to vstinner/cpython that referenced this issue Jun 1, 2023
Update Lib/test/clinic.test manually for updated Py_UNICODE
converter: it now uses wchar_t type rather than Py_UNICODE.
vstinner added a commit to vstinner/cpython that referenced this issue Jun 1, 2023
Update Lib/test/clinic.test manually for updated Py_UNICODE
converter: it now uses wchar_t type rather than Py_UNICODE.
vstinner added a commit that referenced this issue Jun 1, 2023
Update Lib/test/clinic.test manually for updated Py_UNICODE
converter: it now uses wchar_t type rather than Py_UNICODE.
vstinner added a commit to vstinner/cpython that referenced this issue Jun 6, 2023
_PyUnicode_ToLowercase(), _PyUnicode_ToUppercase(),
_PyUnicode_ToTitlecase() are no longer deprecated in the
documentation. It's no longer needed since they now use Py_UCS4 type,
rather than the deprecated Py_UNICODE type.
vstinner added a commit that referenced this issue Jun 6, 2023
_PyUnicode_ToLowercase(), _PyUnicode_ToUppercase(),
_PyUnicode_ToTitlecase() are no longer deprecated in the
documentation. It's no longer needed since they now use Py_UCS4 type,
rather than the deprecated Py_UNICODE type.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

1 participant