From 38500d5ea2efac8345429ba4315306dde0a4daa0 Mon Sep 17 00:00:00 2001 From: Mike Wilson <37758309+kosh271@users.noreply.github.com> Date: Wed, 11 Feb 2026 09:12:59 -0500 Subject: [PATCH] Fix type3e.py variable type issues The tests used to validate the range of the values supplied to set_access_opt() were stored as the incorrect type within the class. struct.pack() outputs a bytes object, but the values must be of type int to function correctly when _build_send_data() is called (which also performs the struct.pack() operation on the self. variables. --- pymelsec/type3e.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/pymelsec/type3e.py b/pymelsec/type3e.py index 515c033..bb9c1b2 100644 --- a/pymelsec/type3e.py +++ b/pymelsec/type3e.py @@ -267,27 +267,33 @@ def set_access_opt(self, self._set_comm_type(comm_type) if network: try: - self.network = struct.pack('B', network) + struct.pack('B', network) # Test + self.network = network # Store except: raise ValueError("network must be 0 <= network <= 255") if pc: try: - self.pc = struct.pack('B', pc) + struct.pack('B', pc) # Test + self.pc = pc # Store except: raise ValueError("pc must be 0 <= pc <= 255") if dest_moduleio: try: - self.dest_moduleio = struct.pack('