@@ -638,16 +638,22 @@ def setfieldval(self, attr, val):
638638 # Optimization:
639639 # Try to avoid replacing a value by the same value,
640640 # and avoid recursive cache invalidation by the way.
641- old_val = self .getfieldval (attr ) # type: Any
642- if (
643- # In case of packets, check the given packet reference differs from the previous one.
644- (val is old_val ) if isinstance (val , Packet )
645- # In case of lists, let's take the new value whatever (no optimization).
646- else False if isinstance (val , list )
647- # In the general case, compare the values.
648- else (val == old_val )
649- ):
650- return
641+ try :
642+ old_val = self .getfieldval (attr ) # type: Any
643+ if (
644+ # In case of packets, check the given packet reference differs from the previous one.
645+ (val is old_val ) if isinstance (val , Packet )
646+ # In case of lists, let's take the new value whatever (no optimization).
647+ else False if isinstance (val , list )
648+ # In the general case, compare the values.
649+ else (val == old_val )
650+ ):
651+ return
652+ except AttributeError :
653+ # Field name can't be found (yet?).
654+ # Let the execution go on, especially on the payload.
655+ # An `AttributeError` may eventually be raised in case of a `NoPayload`.
656+ pass
651657
652658 if self .deprecated_fields and attr in self .deprecated_fields :
653659 attr = self ._resolve_alias (attr )
0 commit comments