Skip to content

Remove Py_UNICODE APIs except PEP 623 #85295

Description

@methane
BPO 41123
Nosy @vstinner, @methane, @miss-islington
PRs
  • bpo-41123: Remove Py_UNICODE_str* macros #21164
  • bpo-41123: Doc: Document Py_UNICODE APIs will be removed in 3.10 #21181
  • bpo-41123: Remove PyUnicode_GetMax() #21192
  • bpo-41123: Remove PyLong_FromUnicode() #21204
  • [3.9] bpo-41123: Doc: PyLong_FromUnicode will be removed in 3.10 #21205
  • [3.8] bpo-41123: Doc: PyLong_FromUnicode will be removed in 3.10 (GH-21205) #21207
  • bpo-41123: Remove PyUnicode_AsUnicodeCopy #21209
  • [3.9] bpo-41123: Remove PyUnicode_AsUnicodeCopy in 3.10 #21227
  • [3.8] bpo-41123: Remove PyUnicode_AsUnicodeCopy in 3.10 (GH-21227) #21230
  • bpo-41123: Remove Py_UNICODE_COPY() and Py_UNICODE_FILL() #28887
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2021-03-16.04:23:19.290>
    created_at = <Date 2020-06-26.03:53:21.785>
    labels = ['expert-C-API', '3.10']
    title = 'Remove Py_UNICODE APIs except PEP 623'
    updated_at = <Date 2021-10-11.21:36:45.040>
    user = 'https://github.com/methane'

    bugs.python.org fields:

    activity = <Date 2021-10-11.21:36:45.040>
    actor = 'vstinner'
    assignee = 'none'
    closed = True
    closed_date = <Date 2021-03-16.04:23:19.290>
    closer = 'methane'
    components = ['C API']
    creation = <Date 2020-06-26.03:53:21.785>
    creator = 'methane'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 41123
    keywords = ['patch']
    message_count = 14.0
    messages = ['372407', '372460', '372468', '372489', '372537', '372538', '372539', '372544', '372545', '372548', '372646', '372657', '372666', '403690']
    nosy_count = 3.0
    nosy_names = ['vstinner', 'methane', 'miss-islington']
    pr_nums = ['21164', '21181', '21192', '21204', '21205', '21207', '21209', '21227', '21230', '28887']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue41123'
    versions = ['Python 3.10']

    Activity

    1. methane commented on Jun 26, 2020

      @methane
      MemberAuthor

      # APIs relating to wstr

      Since some APIs did not have Py_DEPRECATE until 3.9 (see #65140), it can not be removed in 3.10. I wrote PEP-623 for them.

      This issue doesn't about them.

      # Deprecated since Python 3.3, and not documented.

      In Python 3.3 what's new:

      • :c:macro:`Py_UNICODE_strlen`: use :c:func:`PyUnicode_GetLength` or
        :c:macro:`PyUnicode_GET_LENGTH`
      • :c:macro:`Py_UNICODE_strcat`: use :c:func:`PyUnicode_CopyCharacters` or
        :c:func:`PyUnicode_FromFormat`
      • :c:macro:`Py_UNICODE_strcpy`, :c:macro:`Py_UNICODE_strncpy`,
        :c:macro:`Py_UNICODE_COPY`: use :c:func:`PyUnicode_CopyCharacters` or
        :c:func:`PyUnicode_Substring`
      • :c:macro:`Py_UNICODE_strcmp`: use :c:func:`PyUnicode_Compare`
      • :c:macro:`Py_UNICODE_strncmp`: use :c:func:`PyUnicode_Tailmatch`
      • :c:macro:`Py_UNICODE_strchr`, :c:macro:`Py_UNICODE_strrchr`: use
        :c:func:`PyUnicode_FindChar`

      These functions are not documented. But they has Py_DEPRECATED(3.3) from Python 3.6.
      Let's remove them in 3.10.

      # Deprecated since Python 3.3 with document

      Some APIs has document with .. deprecated:: 3.3 4.0.

      • PyLong_FromUnicode
      • PyUnicode_TransformDecimalToASCII
      • PyUnicode_AsUnicodeCopy
      • PyUnicode_Encode
      • PyUnicode_EncodeUTF7
      • PyUnicode_EncodeUTF8
      • PyUnicode_EncodeUTF16
      • PyUnicode_EncodeUTF32
      • PyUnicode_EncodeUnicodeEscape
      • PyUnicode_EncodeRawUnicodeEscape
      • PyUnicode_EncodeLatin1
      • PyUnicode_EncodeASCII
      • PyUnicode_EncodeCharmap
      • PyUnicode_TranslateCharmap
      • PyUnicode_EncodeMBCS

      a) Can we replace 4.0 with 3.10 and remove them in 3.10?
      b) Or should we replace 4.0 with 3.11 and wait one more year?

    2. methane commented on Jun 27, 2020

      @methane
      MemberAuthor

      New changeset 20a7902 by Inada Naoki in branch 'master':
      bpo-41123: Remove Py_UNICODE_str* functions (GH-21164)
      20a7902

    3. methane commented on Jun 27, 2020

      @methane
      MemberAuthor

      a) Can we replace 4.0 with 3.10 and remove them in 3.10?
      b) Or should we replace 4.0 with 3.11 and wait one more year?

      I chose this because they are deprecated since 3.3, and Py_DEPRECATED is used since 3.6.

    4. methane commented on Jun 28, 2020

      @methane
      MemberAuthor

      APIs have /* Py_DEPRECATED(3.3) */

      • PyUnicode_EncodeDecimal
        It is used in PyLong_FromUnicode. Deprecate in 3.10 and remove in 3.12

      • PyUnicode_TransformDecimalToASCII
        While PEP-393 deprecate this too, its document doesn't has deprecated. Deprecate in 3.10 and remove in 3.12

      • _PyUnicode_ToLowercase, _PyUnicode_ToUppercase
        They are not deprecated by PEP-393, but bpo-12736. Deprecate in 3.10 and remove in 3.12.
        On the other hand, _PyUnicode_ToTitlecase has Py_DEPRECATED. It can be removed in 3.10.

    5. methane commented on Jun 29, 2020

      @methane
      MemberAuthor

      I confirmed PyUnicode_GetMax is not used in top4000 packages.

    6. methane commented on Jun 29, 2020

      @methane
      MemberAuthor

      New changeset d9f2a13 by Inada Naoki in branch 'master':
      bpo-41123: Remove PyUnicode_GetMax() (GH-21192)
      d9f2a13

    7. methane commented on Jun 29, 2020

      @methane
      MemberAuthor

      New changeset e4f1fe6 by Inada Naoki in branch 'master':
      bpo-41123: Remove PyLong_FromUnicode() (GH-21204)
      e4f1fe6

    8. methane commented on Jun 29, 2020

      @methane
      MemberAuthor

      New changeset 02134da by Inada Naoki in branch '3.9':
      bpo-41123: Doc: PyLong_FromUnicode will be removed in 3.10 (GH-21205)
      02134da

    9. miss-islington commented on Jun 29, 2020

      @miss-islington
      Contributor

      New changeset ea16430 by Miss Islington (bot) in branch '3.8':
      bpo-41123: Doc: PyLong_FromUnicode will be removed in 3.10 (GH-21205)
      ea16430

    10. methane commented on Jun 29, 2020

      @methane
      MemberAuthor

      PyUnicode_AsUnicodeCopy is not used in top 4000 packages. Let's remove it too.

    11. methane commented on Jun 30, 2020

      @methane
      MemberAuthor

      New changeset b333266 by Inada Naoki in branch 'master':
      bpo-41123: Remove PyUnicode_AsUnicodeCopy (GH-21209)
      b333266

    12. methane commented on Jun 30, 2020

      @methane
      MemberAuthor

      New changeset 2ea6a99 by Inada Naoki in branch '3.9':
      bpo-41123: Remove PyUnicode_AsUnicodeCopy in 3.10 (GH-21227)
      2ea6a99

    13. miss-islington commented on Jun 30, 2020

      @miss-islington
      Contributor

      New changeset 41d6e3f by Miss Islington (bot) in branch '3.8':
      bpo-41123: Remove PyUnicode_AsUnicodeCopy in 3.10 (GH-21227)
      41d6e3f

    14. vstinner commented on Oct 11, 2021

      @vstinner
      Member

      New changeset 1f316ea by Victor Stinner in branch 'main':
      bpo-41123: Remove Py_UNICODE_COPY() and Py_UNICODE_FILL() (GH-28887)
      1f316ea

    15. transferred this issue fromon Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    No one assigned

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions