Issue 33569: dataclasses InitVar does not maintain any type info (original) (raw)

Issue33569

This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

This issue has been migrated to GitHub: https://github.com/python/cpython/issues/77750

classification

Title: dataclasses InitVar does not maintain any type info
Type: behavior Stage: resolved
Components: Versions: Python 3.7

process

Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: eric.smith Nosy List: eric.smith, hack.augusto, levkivskyi, reinhrst
Priority: normal Keywords: patch

Created on 2018-05-18 12:39 by reinhrst, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 8927 merged hack.augusto,2018-08-25 17:46
Messages (7)
msg317026 - (view) Author: (reinhrst) Date: 2018-05-18 12:39
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.
msg317343 - (view) Author: Eric V. Smith (eric.smith) * (Python committer) Date: 2018-05-22 20:37
This seems like a reasonable request.
msg323804 - (view) Author: Augusto Hack (hack.augusto) * Date: 2018-08-20 17:54
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?
msg324001 - (view) Author: Eric V. Smith (eric.smith) * (Python committer) Date: 2018-08-24 14:25
Can you create a pull request? It's easier to review that way.
msg324025 - (view) Author: Eric V. Smith (eric.smith) * (Python committer) Date: 2018-08-25 01:05
test message, please ignore
msg344367 - (view) Author: Eric V. Smith (eric.smith) * (Python committer) Date: 2019-06-03 02:14
New changeset 01ee12ba35a333e8a6a25c4153c4a21838e9585c by Eric V. Smith (Augusto Hack) in branch 'master': bpo-33569 Preserve type information with dataclasses.InitVar (GH-8927) https://github.com/python/cpython/commit/01ee12ba35a333e8a6a25c4153c4a21838e9585c
msg344368 - (view) Author: Eric V. Smith (eric.smith) * (Python committer) Date: 2019-06-03 02:15
Thanks for the PR!
History
Date User Action Args
2022-04-11 14:59:00 admin set github: 77750
2019-06-03 02:15:21 eric.smith set status: open -> closedtype: behaviormessages: + resolution: fixedstage: patch review -> resolved
2019-06-03 02:14:54 eric.smith set messages: +
2018-08-25 17:46:32 hack.augusto set keywords: + patchstage: patch reviewpull_requests: + <pull%5Frequest8399>
2018-08-25 01:05:27 eric.smith set messages: +
2018-08-24 14:25:51 eric.smith set messages: +
2018-08-20 17:54:47 hack.augusto set nosy: + hack.augustomessages: +
2018-06-23 10:26:01 eric.smith set assignee: eric.smith
2018-05-23 15:09:31 levkivskyi set nosy: + levkivskyi
2018-05-22 20:37:45 eric.smith set nosy: + eric.smithmessages: +
2018-05-18 12:39:55 reinhrst create