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

Add ability to serialise types.Union #88842

Closed
uriyyo opened this issue Jul 19, 2021 · 9 comments
Closed

Add ability to serialise types.Union #88842

uriyyo opened this issue Jul 19, 2021 · 9 comments
Labels
3.10 only security fixes 3.11 only security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs) stdlib Python modules in the Lib dir type-feature A feature request or enhancement

Comments

@uriyyo
Copy link
Member

uriyyo commented Jul 19, 2021

BPO 44676
Nosy @ambv, @serhiy-storchaka, @pablogsal, @miss-islington, @uriyyo, @Fidget-Spinner
PRs
  • bpo-44676: Add ability to serialise types.Union #27244
  • bpo-44676: Serialize the union type using only public API #27323
  • bpo-44676: Fix reference leaks in union_reduce #27332
  • [3.10] bpo-44676: Add ability to serialize types.Union (GH-27244) #27333
  • [3.10] Partially revert "bpo-44676: Add ability to serialize types.Union (GH-27244) (GH-27333)" #27335
  • [3.10] bpo-44676: Serialize the union type using only public API (GH-27323) #27340
  • 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-07-25.02:23:58.254>
    created_at = <Date 2021-07-19.16:20:13.599>
    labels = ['interpreter-core', 'type-feature', 'library', '3.10', '3.11']
    title = 'Add ability to serialise types.Union'
    updated_at = <Date 2021-07-25.02:23:58.253>
    user = 'https://github.com/uriyyo'

    bugs.python.org fields:

    activity = <Date 2021-07-25.02:23:58.253>
    actor = 'kj'
    assignee = 'none'
    closed = True
    closed_date = <Date 2021-07-25.02:23:58.254>
    closer = 'kj'
    components = ['Interpreter Core', 'Library (Lib)']
    creation = <Date 2021-07-19.16:20:13.599>
    creator = 'uriyyo'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 44676
    keywords = ['patch']
    message_count = 9.0
    messages = ['397814', '398041', '398125', '398153', '398156', '398158', '398171', '398174', '398178']
    nosy_count = 6.0
    nosy_names = ['lukasz.langa', 'serhiy.storchaka', 'pablogsal', 'miss-islington', 'uriyyo', 'kj']
    pr_nums = ['27244', '27323', '27332', '27333', '27335', '27340']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue44676'
    versions = ['Python 3.10', 'Python 3.11']

    @uriyyo
    Copy link
    Member Author

    uriyyo commented Jul 19, 2021

    It was discussed at https://bugs.python.org/issue44490

    @uriyyo uriyyo added 3.11 only security fixes type-feature A feature request or enhancement labels Jul 19, 2021
    @ambv
    Copy link
    Contributor

    ambv commented Jul 23, 2021

    New changeset fe13f0b by Yurii Karabas in branch 'main':
    bpo-44676: Add ability to serialize types.Union (GH-27244)
    fe13f0b

    @ambv ambv closed this as completed Jul 23, 2021
    @ambv ambv closed this as completed Jul 23, 2021
    @serhiy-storchaka
    Copy link
    Member

    It is not good to use private method in pickle, because we will not be able to get rid of it for backward compatibility. Why not use functools.reduce()?

    @pablogsal
    Copy link
    Member

    This PR has introduced reference leaks. Bisecting points to:

    fe13f0b is the first bad commit
    commit fe13f0b
    Author: Yurii Karabas <1998uriyyo@gmail.com>
    Date: Fri Jul 23 12:47:00 2021 +0300

    bpo-44676: Add ability to serialize types.Union (GH-27244)
    

    Lib/test/test_types.py | 35 +++++++++++++++
    Lib/typing.py | 4 +-
    .../2021-07-19-19-53-46.bpo-44676.WgIMvh.rst | 2 +
    Objects/unionobject.c | 51 ++++++++++++++++++++++
    4 files changed, 90 insertions(+), 2 deletions(-)
    create mode 100644 Misc/NEWS.d/next/Core and Builtins/2021-07-19-19-53-46.bpo-44676.WgIMvh.rst
    bisect run successfe13f0b0f696464dd6f283576668dbf57cb11399 is the first bad commit
    commit fe13f0b
    Author: Yurii Karabas <1998uriyyo@gmail.com>
    Date: Fri Jul 23 12:47:00 2021 +0300

    bpo-44676: Add ability to serialize types.Union (GH-27244)
    

    Lib/test/test_types.py | 35 +++++++++++++++
    Lib/typing.py | 4 +-
    .../2021-07-19-19-53-46.bpo-44676.WgIMvh.rst | 2 +
    Objects/unionobject.c | 51 ++++++++++++++++++++++
    4 files changed, 90 insertions(+), 2 deletions(-)
    create mode 100644 Misc/NEWS.d/next/Core and Builtins/2021-07-19-19-53-46.bpo-44676.WgIMvh.rst
    bisect run success

    Example failure:

    https://buildbot.python.org/all/#/builders/259/builds/100

    Ran 106 tests in 0.053s
    OK
    ......
    test_types leaked [2, 2, 2] references, sum=6
    test_types leaked [1, 1, 1] memory blocks, sum=3
    1 test failed again:
    test_types
    == Tests result: FAILURE then FAILURE ==
    413 tests OK.

    @pablogsal
    Copy link
    Member

    New changeset 9356d1e by Pablo Galindo Salgado in branch '3.10':
    [3.10] bpo-44676: Add ability to serialize types.Union (GH-27244) (GH-27333)
    9356d1e

    @miss-islington
    Copy link
    Contributor

    New changeset 8158e05 by Pablo Galindo Salgado in branch 'main':
    bpo-44676: Fix reference leaks in union_reduce (GH-27332)
    8158e05

    @serhiy-storchaka serhiy-storchaka added interpreter-core (Objects, Python, Grammar, and Parser dirs) stdlib Python modules in the Lib dir 3.10 only security fixes labels Jul 24, 2021
    @serhiy-storchaka
    Copy link
    Member

    New changeset 435a033 by Serhiy Storchaka in branch 'main':
    bpo-44676: Serialize the union type using only public API (GH-27323)
    435a033

    @serhiy-storchaka
    Copy link
    Member

    New changeset 0aea99e by Miss Islington (bot) in branch '3.10':
    bpo-44676: Serialize the union type using only public API (GH-27323) (GH-27340)
    0aea99e

    @Fidget-Spinner
    Copy link
    Member

    This is fixed. Thanks Yurii and Serhiy for the patches :) (and everyone else for the reviews too).

    @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
    Labels
    3.10 only security fixes 3.11 only security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs) stdlib Python modules in the Lib dir type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    6 participants