Skip to content

array: Add 'w' type and deprecate 'u' type. #80480

Closed

Description

@methane
BPO 36299
Nosy @terryjreedy, @ncoghlan, @methane, @skrah, @serhiy-storchaka
PRs
  • bpo-36299: array('u') uses Py_UCS4 instead of Py_UNICODE  #12497
  • 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 2019-03-15.05:50:02.657>
    labels = ['3.8', 'library']
    title = "array: Deprecate 'u' type in array module"
    updated_at = <Date 2020-04-23.00:47:43.731>
    user = 'https://github.com/methane'

    bugs.python.org fields:

    activity = <Date 2020-04-23.00:47:43.731>
    actor = 'methane'
    assignee = 'none'
    closed = False
    closed_date = None
    closer = None
    components = ['Library (Lib)']
    creation = <Date 2019-03-15.05:50:02.657>
    creator = 'methane'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 36299
    keywords = ['patch']
    message_count = 12.0
    messages = ['337967', '338031', '338595', '338598', '338607', '338608', '338609', '338610', '338611', '367000', '367044', '367065']
    nosy_count = 5.0
    nosy_names = ['terry.reedy', 'ncoghlan', 'methane', 'skrah', 'serhiy.storchaka']
    pr_nums = ['12497']
    priority = 'normal'
    resolution = None
    stage = None
    status = 'open'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue36299'
    versions = ['Python 3.8']

    Linked PRs

    Activity

    1. transferred this issue fromon Apr 10, 2022
    2. ezio-melotti commented on Aug 4, 2022

      @ezio-melotti
      Member

      Even though this has been deprecated in the docs since 3.3, it doesn't seem to raise a DeprecationWarning. If we want to remove it we should add the warning, and then remove it in a later version. The documentation should also be updated according to the plan (see #93986).

    3. added 9 commits that reference this issue on Aug 6, 2022
    4. hugovk commented on Aug 7, 2022

      @hugovk
      Member

      Please see PR #95760 to emit a DeprecationWarning.

    5. added a commit that references this issue on Aug 14, 2022
    6. hugovk commented on Nov 27, 2022

      @hugovk
      Member
      • Add 'w' for Py_UCS4.

      @methane Would you be able to look into this? It would be good to have the replacement ready when we start emitting deprecation warnings.

    7. hugovk commented on May 2, 2023

      @hugovk
      Member

      The 3.12 beta feature freeze is in a week, so we will likely need to target changing this in 3.13 with removal in 3.15.

    8. added
      3.13only security fixes
      type-featureA feature request or enhancement
      and removed
      stdlibStandard Library Python modules in the Lib/ directory
      on May 5, 2023
    9. encukou commented on May 9, 2023

      @encukou
      Member

      How about:

      • Add 'w' for Py_UCS4.
      • Wait until all Python versions that don't have w reach end of life
      • Deprecate 'u', and remove it in the future.

      Is there a reason to rush this?

    10. methane commented on May 10, 2023

      @methane
      MemberAuthor

      array('u') will cause bugs and almost no valid use case for it.
      So waiting deprecation 5+ years seems too slow.

      On the other hand, I don't hurry about removing it.
      I can wait 3+ releases instead of minimum 2 releases.

      My plan is:

      • Add 'w' and deprecate 'u' in Python 3.13
      • Remove 'u' in Python 3.16+ (Postpone removal if some users still use 'u').
    11. changed the title [-]array: Deprecate 'u' type in array module[/-] [+]array: Add 'w' type and deprecate 'u' type.[/+] on May 10, 2023
    12. added a commit that references this issue on Jun 4, 2023
    13. vstinner commented on Jun 6, 2023

      @vstinner
      Member

      @methane added array.array('w') format to Python 3.13.

      @methane: Would you mind to also document the addition with versionchanged in https://docs.python.org/dev/library/array.html ? Currently, it's only documented at: https://docs.python.org/dev/whatsnew/3.13.html#array

    14. vstinner commented on Jun 6, 2023

      @vstinner
      Member

      I dislike the fact that array.array('u') is only deprecated in the doc. I would prefer to either emit a DeprecationWarning at runtime, or remove the deprecation. See also issue #105373. I'm fine with really deprecating it if someone wants to submit a PR (@methane ?).

    15. hugovk commented on Jun 6, 2023

      @hugovk
      Member

      @vstinner PR already open at #95760 :)

    16. added a commit that references this issue on Jun 11, 2023
    17. hugovk commented on Jun 11, 2023

      @hugovk
      Member

      array('u') will cause bugs and almost no valid use case for it. So waiting deprecation 5+ years seems too slow.

      On the other hand, I don't hurry about removing it. I can wait 3+ releases instead of minimum 2 releases.

      My plan is:

      • Add 'w' and deprecate 'u' in Python 3.13

      Done in #105242 and #95760.

      • Remove 'u' in Python 3.16+ (Postpone removal if some users still use 'u').

      Let's close this issue and come back to this in four years.

    18. added a commit that references this issue on May 8, 2026
    19. added a commit that references this issue on Jun 1, 2026
    20. vstinner commented on Jun 1, 2026

      @vstinner
      Member

      The array u type has been removed by the PR gh-149535.

    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

      3.13only security fixesextension-modulesC modules in the Modules dirtype-featureA feature request or enhancement

      Projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions