diff --git a/can/interfaces/pcan/pcan.py b/can/interfaces/pcan/pcan.py index a9b2c016b..7ca2e45aa 100644 --- a/can/interfaces/pcan/pcan.py +++ b/can/interfaces/pcan/pcan.py @@ -608,8 +608,7 @@ def send(self, msg, timeout=None): CANMsg.MSGTYPE = msgType # copy data - for i in range(msg.dlc): - CANMsg.DATA[i] = msg.data[i] + CANMsg.DATA[:msg.dlc] = msg.data[:msg.dlc] log.debug("Data: %s", msg.data) log.debug("Type: %s", type(msg.data)) @@ -628,8 +627,7 @@ def send(self, msg, timeout=None): # if a remote frame will be sent, data bytes are not important. if not msg.is_remote_frame: # copy data - for i in range(CANMsg.LEN): - CANMsg.DATA[i] = msg.data[i] + CANMsg.DATA[:CANMsg.LEN] = msg.data[:CANMsg.LEN] log.debug("Data: %s", msg.data) log.debug("Type: %s", type(msg.data))