[issue40794] dataclass signatures and docstrings w/future-annotations

2020-05-27 Thread STINNER Victor
Change by STINNER Victor : -- nosy: -vstinner ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.p

[issue40794] dataclass signatures and docstrings w/future-annotations

2020-05-27 Thread Guido van Rossum
Guido van Rossum added the comment: You can do this as part of your mega-PR to turn on `from __future__ import annotations` by default. -- ___ Python tracker ___

[issue40794] dataclass signatures and docstrings w/future-annotations

2020-05-27 Thread Batuhan Taskaya
Batuhan Taskaya added the comment: (I applied it to my own branch, don't know if a seperate PR needed) -- ___ Python tracker ___ __

[issue40794] dataclass signatures and docstrings w/future-annotations

2020-05-27 Thread Batuhan Taskaya
Batuhan Taskaya added the comment: I have applied Guido's suggestion and it looks like it is working. -- ___ Python tracker ___ ___

[issue40794] dataclass signatures and docstrings w/future-annotations

2020-05-27 Thread Eric V. Smith
Eric V. Smith added the comment: I see. Not sure how I overlooked that. Thanks. At first blush, I think your approach would work. -- ___ Python tracker ___ __

[issue40794] dataclass signatures and docstrings w/future-annotations

2020-05-27 Thread Guido van Rossum
Guido van Rossum added the comment: To clarify, for Eric: what Batuhan did is effectively adding `from __future__ import annotations` to the top of dataclasses.py. I believe the root cause is that dataclasses creates functions by synthesizing `def` statements (in _create_fn()) and the annota

[issue40794] dataclass signatures and docstrings w/future-annotations

2020-05-27 Thread Batuhan Taskaya
Batuhan Taskaya added the comment: > Hmm. That's a regression, at least from 3.7, which is the only version I have > ready access to: That is the same behavior with the current master, the problem I am having is related to using annotations feature on dataclasses itself rather than the prog

[issue40794] dataclass signatures and docstrings w/future-annotations

2020-05-27 Thread Eric V. Smith
Eric V. Smith added the comment: Hmm. That's a regression, at least from 3.7, which is the only version I have ready access to: $ python3 Python 3.7.3 (default, Mar 27 2019, 13:36:35) [GCC 9.0.1 20190227 (Red Hat 9.0.1-0.8)] on linux Type "help", "copyright", "credits" or "license" for more

[issue40794] dataclass signatures and docstrings w/future-annotations

2020-05-27 Thread Batuhan Taskaya
Batuhan Taskaya added the comment: > Have you come up with a fix yet? (Preferably a fix that can be applied > locally to dataclasses.py.) I'm working on it, but no luck so far. -- ___ Python tracker __

[issue40794] dataclass signatures and docstrings w/future-annotations

2020-05-27 Thread Guido van Rossum
Guido van Rossum added the comment: Have you come up with a fix yet? (Preferably a fix that can be applied locally to dataclasses.py.) -- ___ Python tracker ___ _

[issue40794] dataclass signatures and docstrings w/future-annotations

2020-05-27 Thread Batuhan Taskaya
Batuhan Taskaya added the comment: > It,sounds like you are trying to get the effect of putting 'from __future__ > import dataclasses' at the top of dataclasses'.py, right? Yes, since compile will automatically inherit the flags of the current frame to the compiled code I'm basically inserti

[issue40794] dataclass signatures and docstrings w/future-annotations

2020-05-27 Thread Guido van Rossum
Guido van Rossum added the comment: It,sounds like you are trying to get the effect of putting 'from __future__ import dataclasses' at the top of dataclasses'.py, right? Are you saying that without this, the output of the test script is correct? -- __

[issue40794] dataclass signatures and docstrings w/future-annotations

2020-05-27 Thread STINNER Victor
Change by STINNER Victor : -- nosy: +gvanrossum, lukasz.langa, vstinner, yselivanov ___ Python tracker ___ ___ Python-bugs-list mail

[issue40794] dataclass signatures and docstrings w/future-annotations

2020-05-27 Thread Batuhan Taskaya
New submission from Batuhan Taskaya : While I was working on making 'future annotations' default, I noticed that dataclasses acts differently under the annotation feature. One example would be the file [signature.py]: [ without future import] $ python t.py X(a: int, b: int) [ with future imp