diff options
author | zsquareplusc <cliechti@gmx.net> | 2019-08-13 13:56:59 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-08-13 13:56:59 +0200 |
commit | e20b773c9bc9aabd93504071ffcd30851be5a430 (patch) | |
tree | 5bbc7eb7738efee3fc1bd7f1313181263e61a45e | |
parent | 4f6666b39113ec58459cbc2f7af4d7de11214674 (diff) | |
parent | 24b02e6ae39b11e52137fd5e73c9dccc2cdeeaca (diff) | |
download | pyserial-git-e20b773c9bc9aabd93504071ffcd30851be5a430.tar.gz |
Merge pull request #371 from keelung-yang/master
Don't open port if self.port is not set while entering context manager
-rw-r--r-- | serial/serialutil.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/serial/serialutil.py b/serial/serialutil.py index 2cce816..2785b6f 100644 --- a/serial/serialutil.py +++ b/serial/serialutil.py @@ -559,7 +559,7 @@ class SerialBase(io.RawIOBase): # context manager def __enter__(self): - if not self.is_open: + if self._port is not None and not self.is_open: self.open() return self |