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 module/qualname arguments to make_dataclass for picklability #79413

Open
anntzer mannequin opened this issue Nov 13, 2018 · 4 comments
Open

Add module/qualname arguments to make_dataclass for picklability #79413

anntzer mannequin opened this issue Nov 13, 2018 · 4 comments
Labels
stdlib Python modules in the Lib dir topic-dataclasses type-feature A feature request or enhancement

Comments

@anntzer
Copy link
Mannequin

anntzer mannequin commented Nov 13, 2018

BPO 35232
Nosy @ericvsmith, @ilevkivskyi, @csabella, @remilapeyre
PRs
  • gh-79413: Add module and qualname arguments to dataclasses.make_dataclass() #11371
  • gh-79413: Add module and qualname arguments to dataclasses.make_dataclass() #11371
  • 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 2018-11-13.14:30:46.300>
    labels = ['3.7', '3.8', '3.9', '3.10', 'type-feature', 'library']
    title = 'Add `module`/`qualname` arguments to make_dataclass for picklability'
    updated_at = <Date 2020-06-21.00:43:53.291>
    user = 'https://github.com/anntzer'

    bugs.python.org fields:

    activity = <Date 2020-06-21.00:43:53.291>
    actor = 'remi.lapeyre'
    assignee = 'none'
    closed = False
    closed_date = None
    closer = None
    components = ['Library (Lib)']
    creation = <Date 2018-11-13.14:30:46.300>
    creator = 'Antony.Lee'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 35232
    keywords = ['patch', 'patch']
    message_count = 3.0
    messages = ['329847', '332761', '342283']
    nosy_count = 4.0
    nosy_names = ['eric.smith', 'levkivskyi', 'cheryl.sabella', 'remi.lapeyre']
    pr_nums = ['11371', '11371']
    priority = 'normal'
    resolution = None
    stage = 'patch review'
    status = 'open'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue35232'
    versions = ['Python 3.7', 'Python 3.8', 'Python 3.9', 'Python 3.10']

    @anntzer
    Copy link
    Mannequin Author

    anntzer mannequin commented Nov 13, 2018

    Currently, dataclasses created by make_dataclass are not picklable, because their module is set to "types". It seems that this would be easily fixed by letting make_dataclass gain a module and a qualname kwarg, similarly to the Enum functional form (https://docs.python.org/3/library/enum.html#functional-api).

    @anntzer anntzer mannequin added 3.7 (EOL) end of life stdlib Python modules in the Lib dir labels Nov 13, 2018
    @remilapeyre
    Copy link
    Mannequin

    remilapeyre mannequin commented Dec 30, 2018

    Hi @Anthony.Lee, the __module__ is wrong indeed. The new changeset in #11371 should implement what you need.

    If you don't specify the new module and qualname parameters, make_dataclass() will try to determine the correct module so you should not need to change your code.

    @csabella csabella added 3.8 (EOL) end of life type-feature A feature request or enhancement and removed 3.7 (EOL) end of life labels Apr 11, 2019
    @csabella
    Copy link
    Contributor

    @eric.smith Can you take a look at this when you get a chance? Thanks!

    @remilapeyre remilapeyre mannequin added 3.10 only security fixes 3.7 (EOL) end of life 3.8 (EOL) end of life 3.9 only security fixes and removed 3.8 (EOL) end of life labels Jun 21, 2020
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    @remilapeyre
    Copy link
    Contributor

    The module part of this has been separately reported at #102103 and fixed in #102104.

    Do we need to take care of qualname still? If so I will update my pull request at #11371, otherwise we can close both this issue and its pull-request.

    @picnixz picnixz added topic-dataclasses and removed 3.10 only security fixes 3.9 only security fixes 3.8 (EOL) end of life 3.7 (EOL) end of life labels Aug 16, 2024
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    stdlib Python modules in the Lib dir topic-dataclasses type-feature A feature request or enhancement
    Projects
    Status: No status
    Development

    No branches or pull requests

    3 participants