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

Simplify implementation of the union type #88894

Closed
serhiy-storchaka opened this issue Jul 24, 2021 · 4 comments
Closed

Simplify implementation of the union type #88894

serhiy-storchaka opened this issue Jul 24, 2021 · 4 comments
Labels
3.11 only security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs) type-feature A feature request or enhancement

Comments

@serhiy-storchaka
Copy link
Member

BPO 44731
Nosy @gvanrossum, @serhiy-storchaka, @pablogsal, @uriyyo, @Fidget-Spinner
PRs
  • bpo-44731: Simplify the union type implementation #27318
  • [3.10] bpo-44731: Simplify the union type implementation (GH-27318) #27334
  • 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-24.14:50:23.547>
    created_at = <Date 2021-07-24.07:04:29.579>
    labels = ['interpreter-core', 'type-feature', '3.11']
    title = 'Simplify implementation of the union type'
    updated_at = <Date 2021-07-24.14:50:23.546>
    user = 'https://github.com/serhiy-storchaka'

    bugs.python.org fields:

    activity = <Date 2021-07-24.14:50:23.546>
    actor = 'pablogsal'
    assignee = 'none'
    closed = True
    closed_date = <Date 2021-07-24.14:50:23.547>
    closer = 'pablogsal'
    components = ['Interpreter Core']
    creation = <Date 2021-07-24.07:04:29.579>
    creator = 'serhiy.storchaka'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 44731
    keywords = ['patch']
    message_count = 4.0
    messages = ['398119', '398124', '398155', '398160']
    nosy_count = 5.0
    nosy_names = ['gvanrossum', 'serhiy.storchaka', 'pablogsal', 'uriyyo', 'kj']
    pr_nums = ['27318', '27334']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue44731'
    versions = ['Python 3.11']

    @serhiy-storchaka
    Copy link
    Member Author

    The proposed PR simplifies implementation of the union type by removing direct support of typing types. It was not necessary because all these types implement __or__ and __ror__ methods.

    The only visible difference is that int | TypeVar() etc returns now typing.Union instead of types.Union. But TypeVar() | int already returns typing.Union.

    @serhiy-storchaka serhiy-storchaka added 3.11 only security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs) type-feature A feature request or enhancement labels Jul 24, 2021
    @serhiy-storchaka
    Copy link
    Member Author

    It fixes also bpo-44642.

    @pablogsal
    Copy link
    Member

    New changeset 0828423 by Serhiy Storchaka in branch 'main':
    bpo-44731: Simplify the union type implementation (GH-27318)
    0828423

    @pablogsal
    Copy link
    Member

    New changeset ca5a4cf by Ken Jin in branch '3.10':
    bpo-44731: Simplify the union type implementation (GH-27318) (GH-27334)
    ca5a4cf

    @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.11 only security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs) type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants