Skip to content

Commit e7465c8

Browse files
Ensure cache set for good at the end of Packet._fast_copy() (#4705)
1 parent ead2e51 commit e7465c8

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

scapy/packet.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -543,9 +543,6 @@ def _fast_copy_fields_dict(
543543
# Both `copy()` and `clone_with()` copy the `parent` reference as is.
544544
clone.parent = self.parent
545545

546-
# Both `copy()` and `clone_with()` copy the `raw_packet_cache` attribute as is.
547-
clone.raw_packet_cache = self.raw_packet_cache
548-
549546
# Both `copy()` and `clone_with()` copy the `wirelen` attribute as is.
550547
clone.wirelen = self.wirelen
551548

@@ -574,6 +571,10 @@ def _fast_copy_fields_dict(
574571
# Both `copy()` and `clone_with()` copy the `sniffed_on` attribute as is.
575572
clone.sniffed_on = self.sniffed_on
576573

574+
# Eventually set cache.
575+
# Both `copy()` and `clone_with()` copy the `raw_packet_cache` attribute as is.
576+
clone.raw_packet_cache = self.raw_packet_cache
577+
577578
return clone
578579

579580
def _resolve_alias(self, attr):

0 commit comments

Comments
 (0)