diff options
author | Chris Liechti <cliechti@gmx.net> | 2016-05-11 15:11:27 +0200 |
---|---|---|
committer | Chris Liechti <cliechti@gmx.net> | 2016-05-11 15:11:27 +0200 |
commit | f41b45939754689e5414d0e319664f2b19cb1559 (patch) | |
tree | f2f9550e35c1ec9d36849d95786a4c4dd88d0cac | |
parent | a7db97cb1a39ae52d6a309a888b7e841c0209724 (diff) | |
download | pyserial-git-f41b45939754689e5414d0e319664f2b19cb1559.tar.gz |
fix type check for port (basestring)
-rw-r--r-- | serial/serialutil.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/serial/serialutil.py b/serial/serialutil.py index 05ebd87..7748431 100644 --- a/serial/serialutil.py +++ b/serial/serialutil.py @@ -29,9 +29,9 @@ except (NameError, AttributeError): unicode = str # for Python 3, pylint: disable=redefined-builtin,invalid-name try: - basestr + basestring except (NameError, AttributeError): - basestr = (str,) # for Python 3, pylint: disable=redefined-builtin,invalid-name + basestring = (str,) # for Python 3, pylint: disable=redefined-builtin,invalid-name # "for byte in data" fails for python3 as it returns ints instead of bytes @@ -202,7 +202,7 @@ class SerialBase(io.RawIOBase): """\ Change the port. """ - if port is not None and not isinstance(port, basestr): + if port is not None and not isinstance(port, basestring): raise ValueError('"port" must be None or a string, not {}'.format(type(port))) was_open = self.is_open if was_open: |