We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 09365a7 commit 2af7baaCopy full SHA for 2af7baa
ghapp/ghapp/cattrs.py
@@ -3,6 +3,7 @@
3
4
import attr
5
import cattr
6
+import sys
7
8
def maybe_parse_bool(obj, cls):
9
if isinstance(obj, (str, bytes)):
@@ -51,7 +52,11 @@ def _register_ignore_optional_none(cls, converter=None):
51
52
prev_unstructure = converter._unstructure_func.dispatch(cls)
53
optional_attrs = {
54
f.name for f in attr.fields(cls)
- if isinstance(f.type, typing._GenericAlias) and type(None) in f.type.__args__
55
+ if sys.version_info[0] <= 3 and sys.version_info[1] < 7:
56
+ if isinstance(f.type, typing._Union) and type(None) in f.type.__args__
57
+ else:
58
+ if isinstance(f.type, typing._GenericAlias) and type(None) in f.type.__args__
59
+
60
}
61
62
def unstructure_ignoring_optional_none(obj):
0 commit comments