Skip to content

Commit

Permalink
Cherry-pick PR lovasoa#207: Fix broken user types after typing-inspec…
Browse files Browse the repository at this point in the history
…t 0.8.0

This is cherry-picks PR#207 by @vit-zikmund
  • Loading branch information
dairiki committed Sep 23, 2022
1 parent 65cd843 commit a0dacc8
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions marshmallow_dataclass/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ class User:
Dict,
List,
Mapping,
NewType as typing_NewType,
Optional,
Set,
Tuple,
Expand Down Expand Up @@ -805,12 +806,8 @@ def NewType(
marshmallow.exceptions.ValidationError: {'mail': ['Not a valid email address.']}
"""

def new_type(x: _U):
return x

new_type.__name__ = name
# noinspection PyTypeHints
new_type.__supertype__ = typ # type: ignore
new_type = typing_NewType(name, typ) # type: ignore
# noinspection PyTypeHints
new_type._marshmallow_field = field # type: ignore
# noinspection PyTypeHints
Expand Down

0 comments on commit a0dacc8

Please sign in to comment.