Skip to content

Commit 45ff8eb

Browse files
committed
_infer_injected_bindings: Don't strip NoneType from union bindings
1 parent 95cd47a commit 45ff8eb

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

injector/__init__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1355,9 +1355,8 @@ def _recreate_annotated_origin(annotated_type: Any) -> Any:
13551355
if only_explicit_bindings and _inject_marker not in metadata or _noinject_marker in metadata:
13561356
del bindings[k]
13571357
elif _is_specialization(v, Union) or _is_new_union_type(v):
1358-
# We don't treat Optional parameters in any special way at the moment.
13591358
union_members = v.__args__
1360-
new_members = tuple(set(union_members) - {type(None)})
1359+
new_members = tuple(set(union_members))
13611360
# mypy stared complaining about this line for some reason:
13621361
# error: Variable "new_members" is not valid as a type
13631362
new_union = Union[new_members] # type: ignore

0 commit comments

Comments
 (0)