Skip to content

Commit 320d804

Browse files
committed
try except
1 parent 1051d6c commit 320d804

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

Lib/dataclasses.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -552,8 +552,10 @@ def __annotate__(format, /):
552552
for k in annotation_fields:
553553
# gh-142214: The annotation may be missing in unusual dynamic cases.
554554
# If so, just skip it.
555-
if k in cls_annotations:
555+
try:
556556
new_annotations[k] = cls_annotations[k]
557+
except KeyError:
558+
pass
557559

558560
if return_type is not MISSING:
559561
if format == Format.STRING:

0 commit comments

Comments
 (0)