Skip to content
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

Remove Py_UNICODE APIs except PEP 623 #85295

Closed
methane opened this issue Jun 26, 2020 · 14 comments
Closed

Remove Py_UNICODE APIs except PEP 623 #85295

methane opened this issue Jun 26, 2020 · 14 comments

Comments

@methane
Copy link
Member

@methane methane commented Jun 26, 2020

BPO 41123
Nosy @vstinner, @methane, @miss-islington
PRs
  • #21164
  • #21181
  • #21192
  • #21204
  • #21205
  • #21207
  • #21209
  • #21227
  • #21230
  • #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']

    @methane
    Copy link
    Member Author

    @methane methane commented Jun 26, 2020

    # 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?

    @methane
    Copy link
    Member Author

    @methane methane commented Jun 27, 2020

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

    @methane
    Copy link
    Member Author

    @methane methane commented Jun 27, 2020

    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.

    @methane
    Copy link
    Member Author

    @methane methane commented Jun 28, 2020

    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.

    @methane
    Copy link
    Member Author

    @methane methane commented Jun 29, 2020

    I confirmed PyUnicode_GetMax is not used in top4000 packages.

    @methane
    Copy link
    Member Author

    @methane methane commented Jun 29, 2020

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

    @methane
    Copy link
    Member Author

    @methane methane commented Jun 29, 2020

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

    @methane
    Copy link
    Member Author

    @methane methane commented Jun 29, 2020

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

    @miss-islington
    Copy link
    Contributor

    @miss-islington miss-islington commented Jun 29, 2020

    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

    @methane
    Copy link
    Member Author

    @methane methane commented Jun 29, 2020

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

    @methane
    Copy link
    Member Author

    @methane methane commented Jun 30, 2020

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

    @methane
    Copy link
    Member Author

    @methane methane commented Jun 30, 2020

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

    @miss-islington
    Copy link
    Contributor

    @miss-islington miss-islington commented Jun 30, 2020

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

    @vstinner
    Copy link
    Member

    @vstinner vstinner commented Oct 11, 2021

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

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants