summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGreg Bowser <topnotcher@gmail.com>2016-11-22 13:04:16 -0500
committerGreg Bowser <topnotcher@gmail.com>2016-11-22 13:37:53 -0500
commit77ca290fd10e532fdf98cea40178651dbe80b365 (patch)
tree47f9c1efe300a0473a7e70ee1c68478a37857ec8
parent0c7077a519092b2f3422b5ea0f3996ee87a5a6f0 (diff)
downloadpyserial-git-77ca290fd10e532fdf98cea40178651dbe80b365.tar.gz
rfc2217: Fix broken calls to to_bytes on Python3.
These all call `to_bytes()` with a list of bytes, which fails in `bytes(bytearray(seq))` on Python 3 since `bytearray` is expecting ints. Solution: Remove the unnecessary calls to `to_bytes()` - the relevant values all seem to have been converted to bytes anyway.
-rw-r--r--serial/rfc2217.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/serial/rfc2217.py b/serial/rfc2217.py
index dee5c2b..e5b9aa0 100644
--- a/serial/rfc2217.py
+++ b/serial/rfc2217.py
@@ -850,12 +850,12 @@ class Serial(SerialBase):
def telnet_send_option(self, action, option):
"""Send DO, DONT, WILL, WONT."""
- self._internal_raw_write(to_bytes([IAC, action, option]))
+ self._internal_raw_write(IAC + action + option)
def rfc2217_send_subnegotiation(self, option, value=b''):
"""Subnegotiation of RFC2217 parameters."""
value = value.replace(IAC, IAC_DOUBLED)
- self._internal_raw_write(to_bytes([IAC, SB, COM_PORT_OPTION, option] + list(value) + [IAC, SE]))
+ self._internal_raw_write(IAC + SB + COM_PORT_OPTION + option + value + IAC + SE)
def rfc2217_send_purge(self, value):
"""\
@@ -989,12 +989,12 @@ class PortManager(object):
def telnet_send_option(self, action, option):
"""Send DO, DONT, WILL, WONT."""
- self.connection.write(to_bytes([IAC, action, option]))
+ self.connection.write(IAC + action + option)
def rfc2217_send_subnegotiation(self, option, value=b''):
"""Subnegotiation of RFC 2217 parameters."""
value = value.replace(IAC, IAC_DOUBLED)
- self.connection.write(to_bytes([IAC, SB, COM_PORT_OPTION, option] + list(value) + [IAC, SE]))
+ self.connection.write(IAC + SB + COM_PORT_OPTION + option + value + IAC + SE)
# - check modem lines, needs to be called periodically from user to
# establish polling