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

dataclasses InitVar does not maintain any type info #77750

Closed
reinhrst mannequin opened this issue May 18, 2018 · 7 comments
Closed

dataclasses InitVar does not maintain any type info #77750

reinhrst mannequin opened this issue May 18, 2018 · 7 comments
Assignees
Labels
3.7 (EOL) end of life type-bug An unexpected behavior, bug, or error

Comments

@reinhrst
Copy link
Mannequin

reinhrst mannequin commented May 18, 2018

BPO 33569
Nosy @ericvsmith, @ilevkivskyi, @reinhrst, @hackaugusto
PRs
  • bpo-33569 Preserve type information with InitVar #8927
  • 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 = 'https://github.com/ericvsmith'
    closed_at = <Date 2019-06-03.02:15:21.610>
    created_at = <Date 2018-05-18.12:39:55.384>
    labels = ['type-bug', '3.7']
    title = 'dataclasses InitVar does not maintain any type info'
    updated_at = <Date 2019-06-03.02:15:21.610>
    user = 'https://github.com/reinhrst'

    bugs.python.org fields:

    activity = <Date 2019-06-03.02:15:21.610>
    actor = 'eric.smith'
    assignee = 'eric.smith'
    closed = True
    closed_date = <Date 2019-06-03.02:15:21.610>
    closer = 'eric.smith'
    components = []
    creation = <Date 2018-05-18.12:39:55.384>
    creator = 'reinhrst'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 33569
    keywords = ['patch']
    message_count = 7.0
    messages = ['317026', '317343', '323804', '324001', '324025', '344367', '344368']
    nosy_count = 4.0
    nosy_names = ['eric.smith', 'levkivskyi', 'reinhrst', 'hack.augusto']
    pr_nums = ['8927']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue33569'
    versions = ['Python 3.7']

    @reinhrst
    Copy link
    Mannequin Author

    reinhrst mannequin commented May 18, 2018

    Right now dataclasses.InitVar[something] is dataclasses.InitVar. This means that any type-information is removed, and it will (for instance) be impossible to do (runtime) type info checks on the generated __init__, or find out anything about the type of the variable.

    @reinhrst reinhrst mannequin added the 3.7 (EOL) end of life label May 18, 2018
    @ericvsmith
    Copy link
    Member

    This seems like a reasonable request.

    @ericvsmith ericvsmith self-assigned this Jun 23, 2018
    @hackaugusto
    Copy link
    Mannequin

    hackaugusto mannequin commented Aug 20, 2018

    I have made some changes to expose the InitVar type, they are available here:

    https://github.com/hackaugusto/dataclasses/tree/initvar_type

    Are these changes sufficient?

    @ericvsmith
    Copy link
    Member

    Can you create a pull request? It's easier to review that way.

    @ericvsmith
    Copy link
    Member

    test message, please ignore

    @ericvsmith
    Copy link
    Member

    New changeset 01ee12b by Eric V. Smith (Augusto Hack) in branch 'master':
    bpo-33569 Preserve type information with dataclasses.InitVar (GH-8927)
    01ee12b

    @ericvsmith
    Copy link
    Member

    Thanks for the PR!

    @ericvsmith ericvsmith added the type-bug An unexpected behavior, bug, or error label Jun 3, 2019
    @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.7 (EOL) end of life type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant