From 4edaad06f35840df19af60c48475103797fcf619 Mon Sep 17 00:00:00 2001 From: Alina Lenk Date: Fri, 1 Jul 2022 23:27:51 +0200 Subject: [PATCH 2/2] generate_packets.py: Remove no-packet flag See osdn#44975 Signed-off-by: Alina Lenk --- common/generate_packets.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/common/generate_packets.py b/common/generate_packets.py index fb51ab235a..819b930716 100755 --- a/common/generate_packets.py +++ b/common/generate_packets.py @@ -1689,9 +1689,6 @@ class Packet: self.delta="no-delta" not in arr if not self.delta: arr.remove("no-delta") - self.no_packet="no-packet" in arr - if self.no_packet: arr.remove("no-packet") - self.handle_via_packet="handle-via-packet" in arr if self.handle_via_packet: arr.remove("handle-via-packet") @@ -1731,9 +1728,9 @@ class Packet: self.key_fields = [field for field in self.fields if field.is_key] self.other_fields = [field for field in self.fields if not field.is_key] - if len(self.fields)==0: + # valid, since self.fields is already set + if self.no_packet: self.delta = False - self.no_packet = True if self.want_dsend: raise ValueError("requested dsend for %s without fields isn't useful" % self.name) @@ -1762,6 +1759,12 @@ class Packet: """Snake-case name of this packet type""" return self.type.lower() + @property + def no_packet(self) -> bool: + """Whether this packet's send functions should take no packet + argument. This is the case iff this packet has no fields.""" + return not self.fields + @property def extra_send_args(self) -> str: """Argements for the regular send function""" -- 2.34.1