exception with from __future__ annotations
See original GitHub issueexample:
from __future__ import annotations
import marshmallow_dataclass
@marshmallow_dataclass.dataclass
class C:
s: str
result
AttributeError: 'str' object has no attribute '__dataclass_fields__'
I believe the problem is in _ _ init _ _.py:
# Base types
if typ in _native_to_marshmallow:
return _native_to_marshmallow[typ](**metadata)
since type is ‘str’ instead of str, the base type isn’t found
marshmallow-dataclass==6.0.0c1
python==3.7.2
Issue Analytics
- State:
- Created 4 years ago
- Reactions:9
- Comments:10 (8 by maintainers)
Top Results From Across the Web
Can't import annotations from __future__ - Stack Overflow
If I use annotations, they are widely supported in 3.7, so no need for a future. If I run my code on an...
Read more >Semshi produces errors with __future__ annotations #116
It's very useful and helpful. But, apparently, Semshi has issues with files containing the following line: from __future__ import annotations.
Read more >__future__ — Future statement definitions — Python 3.11 ...
Else MandatoryRelease records when the feature became part of the language; in releases at or after that, modules no longer need a future...
Read more >Function annotations — Python-Future documentation
Function annotations are a piece of syntax introduced in Python 3.0 that was not backported to Python 2.x. (See PEP 3107: http://www.python.org/dev/peps/pep- ...
Read more >What are Python __future__ imports? - YouTube
Imports from the future !Python allows you to opt in to new features that are planned to change in future versions.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Has there been any update on this? It still seems to be a bug that exists.
@lovasoa I’ve prepared improved version of this PR: https://github.com/lovasoa/marshmallow_dataclass/pull/54 here: https://github.com/lovasoa/marshmallow_dataclass/pull/170 All todos/fixme are resolved, could you please look at it?