Skip to content

Document PyUnicode_* API #46236

Closed
Closed

Description

@avassalotti
BPO 1944
Nosy @malemburg, @birkenfeld, @vstinner, @avassalotti, @berkerpeksag, @vadmium, @serhiy-storchaka, @shihai1991, @furkanonder
PRs
  • bpo-1944: wrap functions with macro #20011
  • Files
  • unicode.patch: docs for PyUnicodes C-API functions: FromFormat, FromFormatV, FromString, FromStringAndSize, Partition, RPartition and RSplit
  • 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 = None
    created_at = <Date 2008-01-27.06:26:42.019>
    labels = ['type-feature', 'docs']
    title = 'Document PyUnicode_* API'
    updated_at = <Date 2020-06-21.12:39:22.129>
    user = 'https://github.com/avassalotti'

    bugs.python.org fields:

    activity = <Date 2020-06-21.12:39:22.129>
    actor = 'shihai1991'
    assignee = 'docs@python'
    closed = False
    closed_date = None
    closer = None
    components = ['Documentation']
    creation = <Date 2008-01-27.06:26:42.019>
    creator = 'alexandre.vassalotti'
    dependencies = []
    files = ['13717']
    hgrepos = []
    issue_num = 1944
    keywords = ['patch']
    message_count = 9.0
    messages = ['61734', '86116', '86121', '89100', '185552', '185725', '264571', '264575', '368582']
    nosy_count = 11.0
    nosy_names = ['lemburg', 'georg.brandl', 'vstinner', 'alexandre.vassalotti', 'donlorenzo', 'docs@python', 'berker.peksag', 'martin.panter', 'serhiy.storchaka', 'shihai1991', 'furkanonder']
    pr_nums = ['20011']
    priority = 'normal'
    resolution = None
    stage = 'patch review'
    status = 'open'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue1944'
    versions = ['Python 3.5', 'Python 3.6']

    [edit @encukou]: Converting the lists below to checkboxes:

    • PyUnicode_Resize
    • PyUnicode_InternImmortal (removed in 3.12)
    • PyUnicode_GetDefaultEncoding
    • PyUnicode_SetDefaultEncoding (removed in 3.2)
    • PyUnicode_BuildEncodingMap
    • PyUnicode_FromFormatV
    • PyUnicode_UTF7
    • PyUnicode_AsEncodedObject
    • PyUnicode_FromOrdinal
    • PyUnicode_DecodeFSDefault
    • PyUnicode_DecodeFSDefaultAndSize
    • PyUnicode_DecodeUTF7
    • PyUnicode_DecodeUTF7Stateful
    • PyUnicode_EncodeDecimal
    • PyUnicode_EncodeUTF7
    • PyUnicode_FromFormat
    • PyUnicode_FromString
    • PyUnicode_FromStringAndSize
    • PyUnicode_GetMax
    • PyUnicode_Partition
    • PyUnicode_RPartition
    • PyUnicode_RSplit
    • PyUnicode_IsIdentifier
    • PyUnicode_Append
    • PyUnicode_AppendAndDel
    • Py_UNICODE_REPLACEMENT_CHARACTER
    • PyUnicodeIter_Type
    • PyUnicode_AsDecodedObject
    • PyUnicode_AsDecodedUnicode
    • PyUnicode_AsEncodedUnicode
    • _PyUnicode_ClearStaticStrings (removed in 3.9)
    • _PyUnicode_EQ (removed in 3.14)
    • _PyUnicode_FromId (private)

    Linked PRs

    Activity

    1. serhiy-storchaka commented on Apr 30, 2016

      @serhiy-storchaka
      Member

      PyUnicode_DecodeCodePageStateful

      Following functions likely should be wrapped with "#ifndef Py_LIMITED_API":

      _PyUnicode_ClearStaticStrings
      _PyUnicode_EQ
      _PyUnicode_FromId

    2. vstinner commented on May 10, 2020

      @vstinner
      Member

      """
      Following functions likely should be wrapped with "#ifndef Py_LIMITED_API":

      _PyUnicode_ClearStaticStrings
      _PyUnicode_EQ
      _PyUnicode_FromId
      """

      It's already the case since at least Python 3.7. Extract of Python 3.7 Include/unicodeobject.h:

      #ifndef Py_LIMITED_API
      /* Return an interned Unicode object for an Identifier; may fail if there is no memory.*/
      PyAPI_FUNC(PyObject*) _PyUnicode_FromId(_Py_Identifier*);
      /* Clear all static strings. */
      PyAPI_FUNC(void) _PyUnicode_ClearStaticStrings(void);
      
      /* Fast equality check when the inputs are known to be exact unicode types
         and where the hash values are equal (i.e. a very probable match) */
      PyAPI_FUNC(int) _PyUnicode_EQ(PyObject *, PyObject *);
      #endif /* !Py_LIMITED_API */
    3. transferred this issue fromon Apr 10, 2022
    4. added a commit that references this issue on Feb 10, 2025
    5. added 2 commits that reference this issue on Feb 10, 2025
    6. added 2 commits that reference this issue on Feb 10, 2025
    7. added 2 commits that reference this issue on Feb 16, 2025
    8. rruuaanng commented on Feb 20, 2025

      @rruuaanng
      Contributor

      I have noticed that some tasks that have already been opened are not checked off. I believe we should select them.

    9. added a commit that references this issue on Feb 20, 2025
    10. added 2 commits that reference this issue on Feb 20, 2025
    11. added 2 commits that reference this issue on Feb 20, 2025
    12. added a commit that references this issue on Feb 24, 2025
    13. added 2 commits that reference this issue on Feb 24, 2025
    14. added 3 commits that reference this issue on Feb 24, 2025
    15. added a commit that references this issue on Mar 11, 2025
    16. rruuaanng commented on Apr 3, 2025

      @rruuaanng
      Contributor

      @encukou Let's remove the PyUnicode_GetMax entry, which was removed in Misc/NEWS.d/3.10.0a1.rst.

      .. bpo: 41123
      .. date: 2020-06-28-11-39-22
      .. nonce: sjJWjQ
      .. section: C API
      
      Removed ``PyUnicode_GetMax()``.
      
    17. vstinner commented on Apr 3, 2025

      @vstinner
      Member

      Let's remove the PyUnicode_GetMax entry

      I checked the checkbox :-)

    18. added 3 commits that reference this issue on Apr 14, 2025
    19. StanFromIreland commented on Apr 18, 2025

      @StanFromIreland
      Member

      PyUnicode_EncodeDecimal was removed in 3.11

    20. added a commit that references this issue on Apr 22, 2025
    21. StanFromIreland commented on Apr 22, 2025

      @StanFromIreland
      Member

      PyUnicode_AsDecodedObject, PyUnicode_AsDecodedUnicode, PyUnicode_AsEncodedUnicode, PyUnicode_AsEncodedObject are deprecated since 3.6 and should probably be removed by now, do we still want to document them?

      Py_DEPRECATED(3.6) PyAPI_FUNC(PyObject*) PyUnicode_AsDecodedObject(

      Py_DEPRECATED(3.6) PyAPI_FUNC(PyObject*) PyUnicode_AsDecodedUnicode(

      Py_DEPRECATED(3.6) PyAPI_FUNC(PyObject*) PyUnicode_AsEncodedUnicode(

      Py_DEPRECATED(3.6) PyAPI_FUNC(PyObject*) PyUnicode_AsEncodedObject(

    22. vstinner commented on Apr 22, 2025

      @vstinner
      Member

      No, I don't think that it's worth it to document them if they are going to be removed.

    23. added a commit that references this issue on Apr 22, 2025
    24. StanFromIreland commented on Apr 22, 2025

      @StanFromIreland
      Member

      PyUnicode_FromFormatV is documented.

    25. StanFromIreland commented on Apr 22, 2025

      @StanFromIreland
      Member

      No, I don't think that it's worth it to document them if they are going to be removed.

      I agree, though they have been deprecated for many years but there is no planned removal date that I can find. Should we just remove them now?

    26. vstinner commented on Apr 22, 2025

      @vstinner
      Member

      I agree, though they have been deprecated for many years but there is no planned removal date that I can find. Should we just remove them now?

      IMO now it's too late for the 3.14 release cycle. It would be better to schedule such removal at the start of a new dev cycle, such as Python 3.15. Someone also has to check if these functions are used in the wild (ex: run a code search).

    27. StanFromIreland commented on Apr 22, 2025

      @StanFromIreland
      Member

      cc @serhiy-storchaka who originally deprecated them in 0093907

      A new issue is probably best for this, scheduling for 3.15 seems good for now.

    28. added a commit that references this issue on Apr 29, 2025
    29. added 2 commits that reference this issue on Apr 29, 2025
    30. added a commit that references this issue on Apr 29, 2025
    31. StanFromIreland commented on May 1, 2025

      @StanFromIreland
      Member

      The list needs to be updated, just PyUnicode_BuildEncodingMap is left.

    32. added a commit that references this issue on May 9, 2025
    33. added a commit that references this issue on May 9, 2025
    34. vstinner commented on May 9, 2025

      @vstinner
      Member

      The list is complete. I close the issue. Thanks to everybody who was involved in this old issue (2008!).

    35. added 2 commits that reference this issue on May 9, 2025
    36. added a commit that references this issue on Jul 12, 2025
    37. added a commit that references this issue on Aug 4, 2025
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    No one assigned

      Labels

      docsDocumentation in the Doc dirtopic-unicodetype-featureA feature request or enhancement

      Projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions