Skip to content

Commit 2af7baa

Browse files
authored
upstream fix test
1 parent 09365a7 commit 2af7baa

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

ghapp/ghapp/cattrs.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
import attr
55
import cattr
6+
import sys
67

78
def maybe_parse_bool(obj, cls):
89
if isinstance(obj, (str, bytes)):
@@ -51,7 +52,11 @@ def _register_ignore_optional_none(cls, converter=None):
5152
prev_unstructure = converter._unstructure_func.dispatch(cls)
5253
optional_attrs = {
5354
f.name for f in attr.fields(cls)
54-
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+
5560
}
5661

5762
def unstructure_ignoring_optional_none(obj):

0 commit comments

Comments
 (0)