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.

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:00adminsetgithub: 77750
2019-06-03 02:15:21eric.smithsetstatus: open -> closed
type: behavior
messages: + msg344368

resolution: fixed
stage: patch review -> resolved
2019-06-03 02:14:54eric.smithsetmessages: + msg344367
2018-08-25 17:46:32hack.augustosetkeywords: + patch
stage: patch review
pull_requests: + pull_request8399
2018-08-25 01:05:27eric.smithsetmessages: + msg324025
2018-08-24 14:25:51eric.smithsetmessages: + msg324001
2018-08-20 17:54:47hack.augustosetnosy: + hack.augusto
messages: + msg323804
2018-06-23 10:26:01eric.smithsetassignee: eric.smith
2018-05-23 15:09:31levkivskyisetnosy: + levkivskyi
2018-05-22 20:37:45eric.smithsetnosy: + eric.smith
messages: + msg317343
2018-05-18 12:39:55reinhrstcreate