File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed
Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -660,17 +660,18 @@ def _handle_assign(node: ast.Assign, context: EvaluationContext):
660660
661661def _handle_annassign (node , context ):
662662 annotation_value = _resolve_annotation (eval_node (node .annotation , context ), context )
663- value = node .value
664663
665664 # Use Value for generic types
666- use_value = isinstance (annotation_value , GENERIC_CONTAINER_TYPES )
665+ use_value = (
666+ isinstance (annotation_value , GENERIC_CONTAINER_TYPES ) and node .value is not None
667+ )
667668
668669 # LOCAL VARIABLE
669670 if getattr (node , "simple" , False ) and isinstance (node .target , ast .Name ):
670671 name = node .target .id
671672 if use_value :
672673 return _handle_assign (
673- ast .Assign (targets = [node .target ], value = value ), context
674+ ast .Assign (targets = [node .target ], value = node . value ), context
674675 )
675676 context .transient_locals [name ] = annotation_value
676677 return None
@@ -680,7 +681,7 @@ def _handle_annassign(node, context):
680681 attr = node .target .attr
681682 if use_value :
682683 return _handle_assign (
683- ast .Assign (targets = [node .target ], value = value ), context
684+ ast .Assign (targets = [node .target ], value = node . value ), context
684685 )
685686 context .class_transients [attr ] = annotation_value
686687 return None
You can’t perform that action at this time.
0 commit comments