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

Batuhan Taskaya report at bugs.python.org
Wed May 27 08:48:52 EDT 2020


New submission from Batuhan Taskaya <isidentical at gmail.com>:

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 import]
 $ python t.py
X(a: '_type_a', b: '_type_b') -> '_return_type'

This is causing too much test to fail,
AssertionError: '_return_type' is not None

- C(x:'_type_x')->'_return_type'
+ C(x:collections.deque)

- C(x:'_type_x'=<factory>)->'_return_type'
+ C(x:collections.deque=<factory>)

- C(x:'_type_x')->'_return_type'
+ C(x:List[int])

(and more)

----------
files: script.py
messages: 370073
nosy: BTaskaya, eric.smith
priority: normal
severity: normal
status: open
title: dataclass signatures and docstrings w/future-annotations
Added file: https://bugs.python.org/file49195/script.py

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue40794>
_______________________________________


More information about the Python-bugs-list mailing list